-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculator.c
49 lines (36 loc) · 910 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include<stdio.h>
int main()
{
int num1 ,num2 ;
double value;
printf("Enter the number1 =");
scanf("%d",&num1);
printf("Enter the number2 =");
scanf("%d",&num2);
printf("Select the Operation=\n");
printf("PRESS 1 for Addition + \n");
printf("PRESS 2 for Substraction - \n");
printf("PRESS 3 for Multiplication * \n");
printf("PRESS 4 for Division \n");
char op;
scanf("%c",&op);
switch (op)
{
case '+':
printf("%d + %d =%d",num1,num2,num1+num2);
printf("value =%d",value);
break;
case '-':
printf("%d - %d =%d",num1,num2,num1-num2);
break;
case '*':
printf("%d * %d =%d",num1,num2,num1*num2);
break;
case '/':
printf("%d / %d =%d",num1,num2,num1/num2);
break;
default:
printf("Invalid !!!! error !!");
break;
}
}