-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalc.c
46 lines (45 loc) · 1.07 KB
/
calc.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
#include<stdio.h>
#include<windows.h>
#include<stdlib.h>
int main()
{
system("color 3F");
int num1,num2;
int option;
printf("\n\t\t\t======================*Calculator*===================");
printf("\nEnter 1st no: ");
scanf("%d",&num1);
printf("\nEnter the 2nd no: ");
scanf("%d",&num2);
while (num1,num2>=0)
{
printf("\n1.Addition");
printf("\n2.Substraction");
printf("\n3.Multiplication");
printf("\n4.Division");
printf("\nPlease select the option : ");
scanf("%d",&option);
switch (option)
{
case 1:
printf("Answer: %d",num1+num2);
break;
case 2:
printf("Answer: %d",num1-num2);
break;
case 3:
printf("Answer: %d",num1*num2);
break;
case 4:
printf("Answer: %d",num1/num2);
break;
case 5:
printf("invalid option");
break;
default:
Beep(800,1000);
exit(0);
}
}
return 0;
}