SOURCE CODE:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, choice;
while (1)
{
printf("\n1. Addition");
printf("\n2. Subtraction");
printf("\n3. Division");
printf("\n4. Multiplication");
printf("\n5. remainder");
printf("\n6. Exit\n");
printf("\nEnter your choice\n");
scanf("%d", &choice);
switch (choice)
{
case 1:
printf("enter two numbers \n");
scanf("%d%d", &a, &b);
printf("the sum is %d", a + b);
break;
case 2:
printf("enter two numbers \n");
scanf("%d%d", &a, &b);
printf("subtraction is %d", a - b);
break;
case 3:
printf("enter dividend and divisor \n");
scanf("%d%d", &a,&b);
printf("result is %d", a / b);
break;
case 4:
printf("enter two number \n");
scanf("%d%d", &a, &b);
printf("result is %d \n", a * b);
break;
case 5:
printf("enter two numbers \n");
scanf("%d",&a,&b);
printf("remainder is %d ", a % b);
break;
case 6:
exit(0);
break;
default:
printf("invalid input ");
break;
}
}
return 0;
}
OUTPUT:
1. Addition
2. Subtraction
3. Division
4. Multiplication
5. remainder
6. Exit
Enter your choice
2
enter two numbers
70
40
subtraction is 30
1. Addition
2. Subtraction
3. Division
4. Multiplication
5. remainder
6. Exit
Enter your choice
6
0 Comments