# Arithmetic calculator using switch statement

```#include
#include
void main()
{
int choice, no1, no2, result;
clrscr();

printf("\n\n*********************");
printf("\nArithmetic Calculator");
printf("\n*********************");
printf("\n3. Multiplication\n4. Division");
scanf("%d",&choice);

switch(choice){
case 1:
printf("\nEnter the two number:");
scanf("%d %d", &no1, &no2);
result = no1 + no2;
printf("\nThe Addition of %d and %d is %d", no1, no2, result);
break;
case 2:
printf("\nEnter the two number:");
scanf("%d %d", &no1, &no2);
result = no1 - no2;
printf("\nThe Subtaction of %d and %d is %d", no1, no2, result);
break;
case 3:
printf("\nEnter the two number:");
scanf("%d %d", &no1, &no2);
result = no1 * no2;
printf("\nThe Multiplication of %d and %d is %d", no1, no2, result);
break;
case 4:
printf("\nEnter the numerator and denominator:");
scanf("%d %d", &no1, &no2);
if(no2 == 0){
printf("\nError: cannot divide by zero");
}
else{
result = no1 / no2;
printf("\nDivision of %d by %d is %d", no1, no2, result);
}
break;
}
getch();
}
```

Output:

```*********************
Arithmetic Calculator
*********************
2. Subtraction
3. Multiplication
4. Division
Enter the numerator and denominator:5 0
Error: cannot divide by zero
```

### 9 Responses

1. Anonymous says:

now where’s your division ? if denominator is not zero..:)

2. LearnCOnline says:

Thanks buddy… ðŸ™‚

3. I really like your working.

4. i like it.

5. Anonymous says:

amazing

6. Anonymous says:

its nice nd easy to learn

7. Anonymous says:

you r good

8. Tajudheen NK says:

you do best

9. C program says:

Thanks .. nice program for beginners.