-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCopa_de_ambrolandia.c
79 lines (75 loc) · 1.99 KB
/
Copa_de_ambrolandia.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>
int main ()
{
char N[2], S[2];
int idade;
double Vi = 0;
scanf("%s%d%s%lf", &N, &idade, &S, &Vi);
if (idade > 0 && idade <= 120)
{
if ((strcmp(N, "B") == 0) || (strcmp(N, "A") == 0) || (strcmp(N, "F") == 0) || (strcmp(N, "C") == 0) || (strcmp(N, "I") == 0) || (strcmp(N, "R") == 0))
{
if ((strcmp(N, "B") == 0))
{
Vi *= 0.5;
printf("R$ %0.2lf", Vi);
}
else if ((strcmp(N, "A") == 0) && (strcmp(S, "M") == 0) && idade >= 18)
{
printf("R$ %0.2lf", Vi);
}
else if ((strcmp(N, "A") == 0) && (strcmp(S, "F") == 0) && idade >= 18)
{
Vi *= 0.8;
printf("R$ %0.2lf", Vi);
}
else if ((strcmp(N, "A") == 0) && idade < 18)
{
Vi *= 0.8;
printf("R$ %0.2lf", Vi);
}
else if ((strcmp(N, "F") == 0) || (strcmp(N, "C") == 0))
{
if (idade >= 21)
{
Vi *= 0.7;
printf("R$ %0.2lf", Vi);
}
else
{
printf("nao pode comprar");
}
}
else if ((strcmp(N, "I") == 0) || (strcmp(N, "R") == 0))
{
if (idade <= 16)
{
Vi *= 0.6;
printf("R$ %0.2lf", Vi);
}
else
{
Vi *= 0.7;
printf("R$ %0.2lf", Vi);
}
}
}
else
{
if ((strcmp(S, "F") == 0))
{
Vi *= 0.9;
printf("R$ %0.2lf", Vi);
}
else
{
printf("R$ %0.2lf", Vi);
}
}
}
else
{
printf("idade invalida!");
}
}