forked from harsh2102/C
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculator.c
More file actions
36 lines (36 loc) · 775 Bytes
/
Calculator.c
File metadata and controls
36 lines (36 loc) · 775 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
32
33
34
35
36
#include<stdio.h>
int main()
{
int a, b;
char op;
int result;
printf("Enter First Number:");
scanf("%d", &a);
printf("Enter Second Number:");
scanf("%d", &b);
printf("Enter Operator of the Operation you want to perform :");
scanf(" %c", &op);
switch (op)
{
case '+':
result=a+b;
printf("The Sum Is %d", result);
break;
case '-':
result=a-b;
printf("The Subtract Is %d", result);
break;
case '*':
result=a*b;
printf("The Multiply Is %d", result);
break;
case '/':
result=a/b;
printf("The Division Is %d", result);
break;
default:
printf("Please Enter a valid Operator");
break;
}
return 0;
}