Java program to perform the division of two numbers
KW.java
importjava.util.Scanner;classKW{publicstaticvoidmain(Stringargs[]){floata,b;Scannersc=newScanner(System.in);System.out.println("———————————————————————————————————————————");System.out.println("Program to perform the division of two numbers");System.out.println("———————————————————————————————————————————");System.out.print("Enter the dividend ");a=sc.nextFloat();System.out.print("Enter the divisor ");b=sc.nextFloat();System.out.println("Division of two numbers is "+(a/b));System.out.println("———————————————————————————————————————————");}}
Output
kodingwindow@kw:~$ javac KW.java kodingwindow@kw:~$ java KW
———————————————————————————————————————————
Program to perform the division of two numbers
———————————————————————————————————————————
Enter the dividend 1
Enter the divisor 0
Division of two numbers is Infinity
———————————————————————————————————————————
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.
Dear User, We are grateful for your interest in the Kodingwindow Android app. We intend to soon make it available on the Google Play Store. Currently, Android versions 10 and up require manual apk installations. Would you like to get the app?