forked from Nivedpv2004/C-PROGRAMING
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.c
35 lines (34 loc) · 815 Bytes
/
calculator.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<stdio.h>
int main()
{
printf("1.addtion\n2.subtraction\n3.multiplication\n4.division\n5.modulus\n,6.exit\n");
int a,b,c;
printf("enter the value of a and b:\t");
scanf("%d%d",&a,&b);
printf("enter the choice");
scanf("%d",&c);
switch(c)
{
case 1:
printf("addtion of a and b is %d",a+b);
break;
case 2:
printf("subtraction of a and b is %d",a-b);
break;
case 3:
printf("multiplication of a and b is %d",a*b);
break;
case 4:
printf("division of a and b is %d",a/b);
break;
case 5:
printf("modulus of a and b is %d",a%b);
break;
case 6:
printf("exit");
break;
default:
printf("invalid choice");
}
return 0;
}