We would like ask the user to enter two integers.
Get them from the user and display the larger number followed by the words "is larger".
If the numbers are equal, print the message "These numbers are equal".
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner input = new Scanner(System.in); //your code here }/*from w w w .ja v a 2 s. c o m*/ }
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.print("Enter 2 space separated integers: "); int x = input.nextInt(); int y = input.nextInt(); if(x != y) System.out.printf("%d is larger than %d\n", Math.max(x, y), Math.min(x,y)); else System.out.printf("%d and %d are equal\n", x, y); } }