Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Java program 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