-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCalculation.c
More file actions
80 lines (74 loc) · 1.4 KB
/
Copy pathCalculation.c
File metadata and controls
80 lines (74 loc) · 1.4 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include<stdio.h>
#include<math.h>
int main(){
menu();
return 0;
}
void menu();
int i;
printf("Enter:\n");
printf("1.For adding two number.\n");
printf("2.For substract two number.\n");
printf("3.For multiplicaton two number.\n");
printf("4.For division two number.\n");
printf("5.For percentage two number.\n");
scanf("%d", i);
if(i==1){
Adding();
}
else if(i==2){
Subtract();
}
else if(i==3){
Multiple();
}
else if(i==4){
Division();
}
else if(i==5){
Percentage)();
}
int n;
printf("\n1. Return to Menu: \n");
printf("2. Exit. \n");
scanf("%d", &n);
if(n==1){
menu();
}else{
return 0;
}
void Adding(){
double a, b,result=0;
printf("Enter two number:\n");
scanf("%d%d", &a, &b);
result = a + b;
printf("sum is %d", result);
}
void Subtract(){
double a, b,result;
printf("Enter two number:\n");
scanf("%d%d", &a, &b);
result = a - b;
printf("%d", result);
}
void Multiple(){
double a, b,result;
printf("Enter two number:\n");
scanf("%d%d", &a, &b);
result = a *b;
printf("%d", result);
}
void Division(){
double a, b,result;
printf("Enter two number:\n");
scanf("%d%d", &a, &b);
result = a/ b;
printf("%d", result);
}
void Percentage(){
double a, b,result;
printf("Enter two number:\n");
scanf("%d%d", &a, &b);
result = a+a*b/100;
printf("%d", result);
}