# Arithmetic Operators in Java

Arithmetic operators are used to perform basic mathematical operators such as addition, subtraction etc. There are five arithmetic operators available in Java

## Arithmetic Operators

 Operator Name Operator Example Addition + x + y Subtraction – x – y Multiplication * x * y Division / x / y Mod % x % y

``````package com.yawintutor;

public static void main(String[] args) {
int a = 6;
int b = 3;
int c = 0;

c = a + b;

System.out.println("a value is " + a);
System.out.println("b value is " + b);
System.out.println("\n(a + b) is " + c);

}
}``````

### Output

``````a value is 6
b value is 3

(a + b) is 9``````

## Subtraction

Subtraction is used to perform mathematical subtract operation

``````package com.yawintutor;

public class Subtraction {
public static void main(String[] args) {
int a = 6;
int b = 3;
int c = 0;

c = a - b;

System.out.println("a value is " + a);
System.out.println("b value is " + b);
System.out.println("\n(a - b) is " + c);

}
}``````

### Output

``````a value is 6
b value is 3

(a - b) is 3``````

## Multiplication

Multiplication is to perform multiply two numbers

``````package com.yawintutor;

public class Multiplication {
public static void main(String[] args) {
int a = 6;
int b = 3;
int c = 0;

c = a * b;

System.out.println("a value is " + a);
System.out.println("b value is " + b);
System.out.println("\n(a * b) is " + c);

}
}``````

### Output

``````a value is 6
b value is 3

(a * b) is 18``````

## Division

Division is to perform mathematical divide operation

``````package com.yawintutor;

public class Division {
public static void main(String[] args) {
int a = 6;
int b = 3;
int c = 0;

c = a / b;

System.out.println("a value is " + a);
System.out.println("b value is " + b);
System.out.println("\n(a / b) is " + c);

}
}``````

### Output

``````a value is 6
b value is 3

(a / b) is 2``````

## Mod Operator

Mod operator is the remainder value if a value is divided by another number

``````package com.yawintutor;

public class Mod {
public static void main(String[] args) {
int a = 6;
int b = 3;
int c = 0;

c = a % b;

System.out.println("a value is " + a);
System.out.println("b value is " + b);
System.out.println("\n(a % b) is " + c);

}
}``````

### Output

``````a value is 6
b value is 3

(a % b) is 0``````