Java program to check the equality of given numbers
KW.java
importjava.util.Scanner;classKW{publicstaticvoidmain(Stringargs[]){floata,b;Scannersc=newScanner(System.in);System.out.println("———————————————————————————————————————————");System.out.println("Program to check the equality of given numbers");System.out.println("———————————————————————————————————————————");System.out.print("\nEnter the 1st number ");a=sc.nextFloat();System.out.print("\nEnter the 2nd number ");b=sc.nextFloat();if(a>b)System.out.println("\n"+a+" is greater than "+b);elseif(a<b)System.out.println("\n"+a+" is less than "+b);elseSystem.out.println("\n"+a+" is equal to "+b);System.out.println("———————————————————————————————————————————");}}
Output
kodingwindow@kw:~$ javac KW.java kodingwindow@kw:~$ java KW
———————————————————————————————————————————
Program to check the equality of given numbers
———————————————————————————————————————————
Enter the 1st number -10
Enter the 2nd number -50
-10.0 is greater than -50.0
———————————————————————————————————————————
kodingwindow@kw:~$
Dear User, Thank you for visitng KodingWindow. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.