Greater Number Program in Java
import java.util.Scanner;
public class GreaterNumber {
public static void main(String[] args) {
int n1, n2;
Scanner sc = new Scanner(System.in);
System.out.print("Enter n1 number=");
n1 = sc.nextInt();
System.out.print("Enter n2 number=");
n2 = sc.nextInt();
if (n1 < n2) {
System.out.println("n2 is greater than n1.");
} else {
System.out.println("n1 is greater than n2.");
}
}
}
Output:
Enter n1 number=10 Enter n2 number=12 n2 is greater than n1.b. tech. bca icse java java tutorials learn java mca programs