funmain() {println("Enter Two Integer Number")//1valfirst =readLine()?.toInt()!!//2valsecond =readLine()?.toInt()!!//3println("Enter your choice\n A for Addition\n M for Multiply \n D for Division \n S forSubstation")//4valuserChoice=readLine()//5valresult =when(userChoice)//6 {"A","a"->"Addition of Number $first+$second=${first+second}"//7 "S","s"->"SubStraction of Two Number $first-$second=${first-second}"//8 "M","m"->"Multiplication of Two Number $first*$second=${first*second}"//9 "D","d"->"Division of Two Number= $first/$second=${first/second}"//10 else->"Sorry Wrong Choice"//11}println("CalculationResult=$result")//12 }

- Instruct the user to Enter two number for calculation
- The first Number entered by user convert into int and assigned to the First variable
- The Second Number entered by user convert into int and assigned to the second variable
- Instruct the user to Enter their choice to perform the calculation
- The choice entered by the user assigned to the choice variable
- When statement result based on user choice assigned to result variable
- Operation addition is performed if the user enters “A” or “a”
- Operation subtraction is performed if the user enters “S” or “s”
- Operation multiplication is performed if the user enters “M” or “m”
- Operation Division is performed if the user enters “D” or “d”
- if Enter wrong input mentioned in 7,8,9,10 then else part execute
- Finally, Result is print on command prompt

Output of Program

**Addition:-**

Enter Two Integer Number

20

30

Enter your choice

A for Addition

M for Multiply

D for Division

S for Substation

a

Calculation Result=Addition of Number 20+30=50

**Multiplication**

Enter Two Integer Number

30

50

Enter your choice

A for Addition

M for Multiply

D for Division

S for Substation

m

Calculation Result=Multiplication of Two Number 30*50 =1500

**Substation:-**

Enter Two Integer Number

45

50

Enter your choice

A for Addition

M for Multiply

D for Division

S for Substation

s

Calculation Result=SubStraction of Two Number 45-50=-5

**Division:-**

Enter Two Integer Number

200

40

Enter your choice

A for Addition

M for Multiply

D for Division

S for Substation

d

Calculation Result=Division of Two Number= 200/40=5