# Arithmetic Operators (Mathematical Operators) in Kotlin

## Arithmetic Operator Types

Kotlin has 5 Arithmetic Operators similar to Java. They are

- Addition operator (+)
- Subtraction operator (-)
- Multiplication operator (*)
- Division operator (/)
- Modulus operator (%)

Which is also called as Mathematical Operator

## Syntax

### Addition Operator

```
var variable_one = variable_two + variable_three
For example,
var sum = 1+2
```

### Subtraction Operator

```
var variable_one = variable_two - variable_three
For example,
var sub = 10-2
```

### Multiplication Operator

```
var variable_one = variable_two * variable_three
For example,
var mul = 10*2
```

### Division Operator

```
var variable_one = variable_two / variable_three
For example,
var div = 10/2
```

### Modulus Operator

```
var variable_one = variable_two % variable_three
For example,
var mod = 21%4
```

## Arithmetic Operator Example Program in Kotlin

```
//Arithmetic Operator Example Program in Kotlin
//Operator Kotlin Programs, Basic Kotlin Program
fun main(args: Array<String>) {
val num1 = 100;
val num2 = 5
//Addition
val addition = num1+num2
//Subtraction
val subtraction = num1-num2
//Multiplication
val multiplication = num1*num2
//Division
val division = num1/num2
//Modulus
val modulus = num1%num2
println("Addition of $num1 and $num2 is : $addition")
println("Subtraction of $num1 and $num2 is : $subtraction")
println("Multiplication of $num1 and $num2 is : $multiplication")
println("Division of $num1 and $num2 is : $division")
println("Modulus of $num1 and $num2 is : $modulus")
}
```

## Sample Output

```
Addition of 100 and 5 is : 105
Subtraction of 100 and 5 is : 95
Multiplication of 100 and 5 is : 500
Division of 100 and 5 is : 20
Modulus of 100 and 5 is : 0
```

## Kotlin Operators

- Kotlin Operators Overview
- Arithmetic Operators (Mathematical Operators) in Kotlin
- Assignment Operators and Augmented Assignment Operators in Kotlin
- Unary Operators (Sign, Inverts, Increment, and Decrement) in Kotlin
- Logical Operators in Kotlin
- Equality Operators (==, !=) and Referential equality Operators (===, !==) in Kotlin
- Comparison Operators in Kotlin
- In Operator (in and !in) in Kotlin
- Is Operator (is and !is) in Kotlin
- Indexed Access Operator [, ] in Kotlin
- Not Null Assertion Operator in Kotlin
- Safe Call Operator (?.) in Kotlin
- Elvis Operator (?:) in Kotlin
- Range Operator (..) in Kotlin

## Read More Articles

- Declare Variables In Kotlin
- Read Data Input using Scanner in Kotlin
- Double Data type Usage and Type Conversion in Kotlin
- print and println Data Output in Kotlin
- Arithmetic Operators (Mathematical Operators) in Kotlin
- Unary Operators (Sign, Inverts, Increment, and Decrement) in Kotlin
- Printing Variables and Values in Kotlin
- Equality Operators (==, !=) and Referential equality Operators (===, !==) in Kotlin
- Float Data type Usage and Type Conversion in Kotlin
- Long Data type Usage and Type Conversion in Kotlin
- Comparison Operators in Kotlin
- Byte Data type Usage and Type Conversion in Kotlin
- Is Operator (is and !is) in Kotlin
- In Operator (in and !in) in Kotlin
- Char Data type Usage and Type Conversion in Kotlin
- Assignment Operators and Augmented Assignment Operators in Kotlin
- Read Data Input from Command Line in Kotlin
- Read String Data Input in Kotlin
- Indexed Access Operator [, ] in Kotlin
- Elvis Operator (?:) in Kotlin
- Boolean Data type Usage and Type Conversion in Kotlin
- Short Data type Usage and Type Conversion in Kotlin
- Logical Operators in Kotlin
- Not Null Assertion(!!) Operator in Kotlin
- Repeat and Its Usage in Kotlin