-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathL3_2.c
More file actions
50 lines (44 loc) · 849 Bytes
/
Copy pathL3_2.c
File metadata and controls
50 lines (44 loc) · 849 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
40
41
42
43
44
45
46
47
48
49
50
//juagod ajudou pra caramba nesse aqui, as always pq o cara é brabo
#include <stdio.h>
float Soma(float A, float B){
B = A+B;
return B;
}
float Subtracao(float A, float B){
B = A-B;
return B;
}
float Divisao(float A, float B){
B = A/B;
return B;
}
float Multiplicacao(float A, float B){
B = A*B;
return B;
}
int main(){
char o, s;
float A, B;
scanf("%f", &A);
while (scanf("%f %c", &B, &o) ){
s = 0;
scanf("%c", &s);
if (o == 43) {
A = Soma(A, B);
}
else if (o == 45) {
A = Subtracao(A, B);
}
else if (o == 47) {
A = Divisao(A, B);
}
else if (o == 42) {
A = Multiplicacao(A, B);
}
if (s != 32) {
break;
}
}
printf("%.2f", A);
return 0;
}