Java program to perform the arithmetic operations
KW.java
class KW 
{
    public static void main(String args[]) 
    {
        float a=1,b=0;
        System.out.println("———————————————————————————————————————————");
        System.out.println("Program to perform the arithmetic operations");
        System.out.println("———————————————————————————————————————————");
        System.out.println("Value Of a    | "+a);
        System.out.println("Value Of b    | "+b);
        System.out.println("Value Of a/b  | "+(a/b));
        System.out.println("Value Of a+b  | "+(a+b));
        System.out.println("Value Of a-b  | "+(a-b));
        System.out.println("Value Of a*b  | "+(a*b));
        System.out.println("Remainder a%b | "+(a%b));
        System.out.println("Value Of ++a  | "+(++a));
        System.out.println("Value Of b++  | "+(b++));
        System.out.println("———————————————————————————————————————————");
    }
}
Output
kodingwindow@kw:~$ javac KW.java
kodingwindow@kw:~$ java KW ——————————————————————————————————————————— Program to perform the arithmetic operations ——————————————————————————————————————————— Value Of a | 1.0 Value Of b | 0.0 Value Of a/b | Infinity Value Of a+b | 1.0 Value Of a-b | 1.0 Value Of a*b | 0.0 Remainder a%b | NaN Value Of ++a | 2.0 Value Of b++ | 0.0 ——————————————————————————————————————————— kodingwindow@kw:~$
Advertisement