Arithmetic operators

PROGRAM:

To show use of Arithmetic operators.

/**
             * @Prof. Jayesh
             * Here use of arithmetic operators are shown.
             * Arithmetic operators are +, -, /, % etc.

             */


public class ArithmeticOperators {
            public static void main(String args[])
            {
                        int a=10,b=20;
                        System.out.println("a="+a);
                        System.out.println("b="+b);
                        System.out.println("a+b="+(a+b));
                        System.out.println("a-b="+(a-b));
                        System.out.println("a*b="+(a*b));
                        System.out.println("a/b="+(a/b));
                        System.out.println("a%b="+(a%b));      
                        System.out.println("b%a="+(b%a));      
            }
}

OUTPUT:
a=10
b=20
a+b=30
a-b=-10
a*b=200
a/b=0
a%b=10
b%a=0

Related topics

Please use contact page in this website if you find anything incorrect or you want to share more information about the topic discussed above.