forked from sat5297/hacktober-coding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalc.c.txt
More file actions
50 lines (41 loc) · 1.14 KB
/
calc.c.txt
File metadata and controls
50 lines (41 loc) · 1.14 KB
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
50
#include<stdio.h>
void main(){
int sum,diff,mul,div;
int a,b;
printf("Enter the first number \n");
scanf("%d",&a);
printf("Enter the second number \n");
scanf("%d",&b);
printf("**************************\n");
printf("Operations\n");
printf("**************************\n");
printf("Addition +\");
printf("Subtraction -\n");
printf("Multiplication *\n");
printf("Division / \n");
printf("Please enter the character corresponding to the operation \n");
scanf("%c",&c);
switch(c)
{
case ('+'):
sum=a+b;
printf("The sum of the numbers is %d\n",sum);
break;
case('-'):
diff=a-b;
printf("The difference of the numbers is %d\n",diff);
break;
printf("The sum of the numbers is %d\n",sum); >
case('*'):
mul=a*b;
printf("The product of the numbers is %d\n",mul);
break;
case('/'):
div=a/b;
printf("The quotient of the division is %d \n",div);
break;
default :
printf("Please enter the valid character from the list\n");
break;
}
}