Here is Java Program to check greater between two no.
Output of Above Java Program
Enter the 1st no.:
45
Enter the 2nd no.:
85
The result of the operation a>b is false.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | import java.io.*; class optr{ public static void main(String args[]) throws IOException { int a,b; boolean c; DataInputStream din= new DataInputStream(System.in); System.out.println( "Enter the 1st no.: " ); a=Integer.parseInt(din.readLine()); System.out.println( "Enter the 2nd no.: " ); b=Integer.parseInt(din.readLine()); c=a>b; System.out.println( "The result of the operation a>b is " +c+ "." ); } } |
Output of Above Java Program
Enter the 1st no.:
45
Enter the 2nd no.:
85
The result of the operation a>b is false.