-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCalcuator.c
More file actions
79 lines (48 loc) · 1.26 KB
/
Calcuator.c
File metadata and controls
79 lines (48 loc) · 1.26 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
79
#include<stdio.h>
int main(){
printf("Welcome To Calculator");
float n1,n2;
char s;
char Sum = '+';
char Subtraction = '-';
char Product = '*';
char Quotient = '/';
int i;
while (i=5)
{
printf("\n\nEnter 1st Number : ");
scanf("%f",&n1);
printf("\nEnter Operator (+,-,*,/) : ");
scanf("%s",&s);
printf("\nEnter 2nd Number : ");
scanf("%f",&n2);
if (s==Sum)
{
float Sum1 = n1 + n2;
printf("\nYour Sum Is : ");
printf("%f",Sum1);
}
else if (s==Subtraction)
{
float Subtraction1=n1 - n2;
printf("\nYour Subtraction Is : ");
printf("%f",Subtraction1);
}
else if (s==Product)
{
float Product1= n1 * n2;
printf("\nYour Product Is : ");
printf("%f",Product1);
}
else if (s==Quotient)
{
float Quotient1= n1 / n2;
printf("\nYour Quotient Is : ");
printf("%f",Quotient1);
}
else{
printf("\n\nSyntax Error!\n\nTry Again");
}
}
return 0;
}