Here’s the code for a Basic Calculator Using Switch Statements:

#include <stdio.h>
#include <conio.h>

int main(void)
{
int a, b;
int repeat=1;
printf(Welcome to the C calculator\nEnter any two numbers\n);
scanf(%d%d, &a, &b);

while(repeat==1)
{
int choice;
printf(Choose the operation to be performed\nDivision[1]\nMultiplication[2]\nAddition[3]\nSubtraction[4]\n);
scanf(%d, &choice);

int result;
switch(choice)
{
case 1:
result = a/b;
printf(The quotient is %d, result);
break;
case 2:
result = a*b;
printf(The product is %d, result);
break;
case 3:
result = a+b;
printf(The sum is %d, result);
break;
case 4:
result = a-b;
printf(The difference is %d, result);
break;
default:
printf(Please enter a valid choice);
break;
}
printf(\nRepeat[1]\nExit[0]n);
scanf(%d, &repeat);
}
getch();
}

Download the Application (.exe)