-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path9.c
79 lines (63 loc) · 1.55 KB
/
9.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
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
79
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void sum(double n1, double n2);
void sub(double n1, double n2);
void mul(double n1, double n2);
void divi(double n1, double n2);
int main()
{
double number1, number2;
while (1)
{
int choice;
printf("Enter Two Number: ");
scanf("%lf %lf", &number1, &number2);
printf("Please Choose a Operation:\n\n");
printf("1 -> SUMMATION(A + B)\n");
printf("2 -> SUBTACTION(A - B)\n");
printf("3 -> MULTIPICATION(A x B)\n");
printf("4 -> SUMMATION(A %c B)\n", 246);
printf("\n0 -> Quit\n");
printf("Enter Choice: ");
scanf("%d", &choice);
switch (choice)
{
case 1:
sum(number1, number2);
break;
case 2:
sub(number1, number2);
break;
case 3:
mul(number1, number2);
break;
case 4:
divi(number1, number2);
break;
case 0:
exit(0);
break;
default:
printf("Wrong Input.Try Again!!\n");
break;
}
}
return 0;
}
void sum(double n1, double n2)
{
printf("Summation of %lf and %lf = %lf", n1, n2, n1 + n2);
}
void sub(double n1, double n2)
{
printf("Subtraction of %lf and %lf = %lf", n1, n2, n1 - n2);
}
void mul(double n1, double n2)
{
printf("Multiplication of %lf and %lf = %lf", n1, n2, n1 * n2);
}
void divi(double n1, double n2)
{
printf("Division of %lf and %lf = %lf", n1, n2, n1 / n2);
}