Computer Science, asked by anshika673245, 4 months ago

write a program in JAVA to input three numbers and display the greatest of the two number using math.max ()​

Answers

Answered by Oreki
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