write a program in JAVA to input three numbers and display the greatest of the two number using math.max ()
Answers
Answered by
2
import java.util.Scanner;
public class GreatestNumber {
public static void main(String[ ] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter three numbers - ");
int numOne = sc.nextInt( ),
numTwo = sc.nextInt( ),
numThree = sc.nextInt( ),
max = Math.max(numOne, Math.max(numTwo, numThree));
System.out.println("Maximum number - " + max);
}
}
Similar questions