forked from goldendeepkaur/PPS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp13.c
More file actions
39 lines (37 loc) · 763 Bytes
/
p13.c
File metadata and controls
39 lines (37 loc) · 763 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
37
38
39
// To make simple calculator using switch
#include<stdio.h>
void main()
{
int num1, num2, choice;
float result;
printf("\nEnter the first number::");
scanf("%d",&num1);
printf("\nEnter the second number::");
scanf("%d",&num2);
printf("\n\t\tMENU");
printf("\n1 : ADDITION");
printf("\n2 : SUBTRACTION");
printf("\n3 : MULTIPLICATION");
printf("\n4 : DiVISION");
printf("\n Enter your choice of Operation to be performed::");
scanf("%d",&choice);
switch(choice)
{
case 1:
result = num1+num2;
printf("\nThe Sum is %f", result);
break;
case 2:
result=num1-num2;
printf("\nThe Difference is %f",result);
break;
case 3:
result=num1*num2;
printf("\nThe product is %f", result);
break;
case 4:
result = num1/num2;
printf("\nThe quotient is %f", result);
break;
}
}