FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 156   



Arithmetic Operators

Following are the list of Arithmetic Operators

Operator Used For
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder

Following is a sample Java program shows you how to use them.

public class ArithmeticOperators {
    public static void main(String[] args) {
        int a = 10;
        int b = 2;

        int sum = a + b;
        System.out.println("sum is:" + sum);

        int substact = a - b;
        System.out.println("substact is:" + substact);

        int multiply = a * b;
        System.out.println("multiply is:" + multiply);

        int division = a / b;
        System.out.println("division is:" + division);

        int reminder = a % b;
        System.out.println("reminder is: " + reminder);
    }
}

Output

sum is:12
substact is: 8
multiply is: 20
division is: 5
reminder is: 0

Other Arithmetic Operators

Operator Used For
++ Increment
-- Decrement
+= Addition Assignment
-= Subtraction Assignment
*= Multiplication Assignment
/= Division Assignment
%= Modulus Assignment



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News