Write a program in Java to input two numbers and display the greatest and the smallest of the two numbers.Hint: Use Math.min( ) and Math.max( )Sample Input: 87, 34 Sample Output: Greatest Number 87 Smallest number 34 *
Answers
Answered by
6
public class Numbers {
public static void main (String [] args ) {
int a = 87;
int b = 34;
System.out.println("The greatest number is ");
System.out.print(math.max(a , b));
System.out.println("The Smallest number is ");
System.out.print(math.min(a , b));
}
}
Similar questions