Write the java program that calculates maximum of the given two numbers.
import java.util.*;
public class App {
public static void main(String[] args) {
Scanner keyBoard = new Scanner(System.in);
System.out.print("Enter two numbers: ");
int number1 = keyBoard.nextInt();
int number2 = keyBoard.nextInt();
if (number1 > number2) {
System.out.println("Number1 > Number2");
}else if (number1 > number2) {
System.out.println("Number1 < Number2");
}else {
System.out.println("Number1 = Number2");
}
keyBoard.close();
}
}
Comments
Leave a comment