Arithmetic operators are used to perform arithmetic calculations. Java provides basic arithmetic operators. They are +,-, *, /, %. The different Arithmetic operators that were used in java programming.
Arithmetic operators
Operators | Example | Meaning |
+ – * / % | a+b a-b a*b a/b a%b | Addition (or) Unary plus Subtraction (or) Unary minus Multip Iication Division Modulo division (Remainder) |
class JavaArithmeticOperators
{
public static void main(String args[ ])
{
int a=15, b=9;
System.out.println("The Addition is : " +(a+b));
System.out.println("The Subtract is : "+(a-b));
System.out.println("The Multiple is : "+(a*b));
System.out.println("The Division is : " +(a/b));
System.out.println("The Modulo is : "+(a%b));
}
}