Java program to perform the division of two numbers
Codeaft.java
import java.util.Scanner;
class Codeaft 
{
    public static void main(String args[])
    {
        float a,b;
        Scanner sc=new Scanner(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
codeaft@codeaft:~$ javac Codeaft.java
codeaft@codeaft:~$ java Codeaft ——————————————————————————————————————————— Program to perform the division of two numbers ——————————————————————————————————————————— Enter the dividend 1 Enter the divisor 0 Division of two numbers is Infinity ——————————————————————————————————————————— codeaft@codeaft:~$
Comments and Reactions