Arithmetic Operators in Java


The Java programming language supports various arithmetic operators for all floating-point and integer numbers. These operators are + (addition), - (subtraction), * (multiplication), / (division), and % (modulo).

  1. Addition(+): This operator is a binary operator and is used to add two operands.
  2. Subtraction(-): This operator is a binary operator and is used to subtract two operands.
  3. Multiplication(*): This operator is a binary operator and is used to multiply two operands.
  4. Division(/): This is a binary operator that is used to divide the first operand(dividend) by the second operand(divisor) and give the quotient as result.
  5. Modulus(%): This is a binary operator that is used to return the remainder when the first operand(dividend) is divided by the second operand(divisor).

The arithmetic operators perform addition, subtraction, multiplication, division, and modulus operations.

Source Code

//Arithmetic Operators
public class Arithmetic {
    public static void main(String args[])
    {
        int a=123,b=10;
        System.out.println("Addition : "+(a+b));
        System.out.println("Subtraction : "+(a-b));
        System.out.println("Multiplication : "+(a*b));
        System.out.println("Division : "+(a/b));
        System.out.println("Modulus  : "+(a%b));
 
    }
}
 

Output

Addition : 133
Subtraction : 113
Multiplication : 1230
Division : 12
Modulus  : 3
To download raw file Click Here

Basic Programs