-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathoperator
More file actions
31 lines (28 loc) · 587 Bytes
/
operator
File metadata and controls
31 lines (28 loc) · 587 Bytes
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
#include <stdio.h>
int main()
{
char ch;
int a,b;
printf("\n enter operator(+-*/): ");
scanf("%c",&ch);
printf("enter two numbers: ");
scanf("%d%d",&a,&b);
switch(ch){
case'+':
printf("%d+%d=%d",a,b,a+b);
break;
case '-':
printf("%d-%d=%d",a,b,a-b);
break;
case '*':
printf("%d*%d=%d",a,b,a*b);
break;
case '/':
printf("%d/%d=%d",a,b,a/b);
break;
default:
printf("enter correct numbers or operators.");
break;
}
return 0;
}