Write a Java program to create Simple Calculator using switch case.

preview_player
Показать описание
Write a Java program to create Simple Calculator using switch case.
1.Add
2. Sub
3. Mul
4. Div
5. Mod
//Write a Java program to create Simple Calculator using switch case.

class cal
{
public static void main(String args[])
{

switch(choice)
{
case 1:
int add = a+b;
break;

case 2:
int sub = c-d;
break;

case 3:
int mul = e*f;
break;

case 4:
int div = g/h;
break;

case 5:
int mod = i%j;
break;

default:
}


}
}
Рекомендации по теме