Java program to determine greatest number among three input numbers.

 Java program to determine greatest number among three input numbers.


import java.util.Scanner;


public class Largest {

public static void main(String[] args) {

int A,B,C;

Scanner obj1= new Scanner(System.in);

System.out.println("Enter the first number: ");

A=obj1.nextInt();

System.out.println("Enter the second number: ");

B=obj1.nextInt();

System.out.println("Enter the third number: ");

C=obj1.nextInt();

if(A>B && A>C){

System.out.println("A is the greatest number");

}

else if(B>A && B>C) {

System.out.println("B is the greatest number");

}

else {

System.out.println("C is the greates number");

}

obj1.close();

}


}

Output:

Enter the first number: 

19

Enter the second number: 

20

Enter the third number: 

23

C is the greatest number


Comments

Popular posts from this blog

Java Program to find average of Three numbers

A simple method using string to check whether the input password is correct or not

Java Program any letter to upper case Letter(JavaSWING) ActionListener