Design a Simple Calculator using Switch Statement in C

Simple Calculator Program in C:

#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, opt;
clrscr();
printf("Enter the First Number: ");
scanf("%d",&a);
printf("Enter the Second Number: ");
scanf("%d",&b);
for(;;)
{
printf("\n 1. Addition \n 2. Subtraction
\n 3. Multiplication \n 4. Division \n
5. Modulation \n 6. Exit \n");
printf("\n\nEnter the your option: ");
scanf("%d",&opt);
switch(opt)
{
case 1:
printf("\nThe Addition is %d\n", a+b);
break;
case 2:
printf("\nThe Subtraction is %d\n", a-b);
break;
case 3:
printf("\nThe Multiplication is %d\n", a*b);
break;
case 4:
if(b==0)
{
printf("OOps Devide by zero\n");
}
else
{
printf("\nThe Division is %d\n", a/b);
}
break;
case 5:
printf("\nThe Modulation is %d\n", a%b);
break;
case 6:
return 0;
break;
default:
printf("\n Enter Correct Option\n");
break;
}
}
getch();
}

Output-1:

Design a Simple Calculator using Switch Statement in C

Output-2:

Simple Calculator using Switch Statement in C

Output-3:

Calculator using Switch Statement in C

Output-4:

Division in Calculator

Output-5:

modulation in calculator