Java

Program to find Largest Among three numbers.

Program to find Largest Among three numbers.
import java.util.*;
import java.lang.*;
import java.io.*;

public class Largest {

    public static void main(String[] args) {

        int n1 = 4, n2 = 3, n3 = 2;

        if( n1 >= n2 && n1 >= n3)
            System.out.println(n1 + " is the largest number.");

        else if (n2 >= n1 && n2 >= n3)
            System.out.println(n2 + " is the largest number.");

        else
            System.out.println(n3 + " is the largest number.");
    }
}
Nikhil Juneja

Passionate software developer and technical contributor at TutorialsLink.