-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsurvey.c
More file actions
33 lines (26 loc) · 674 Bytes
/
Copy pathsurvey.c
File metadata and controls
33 lines (26 loc) · 674 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
#include <stdio.h>
#include <unistd.h>
int main() {
int marvel = 0, dc = 0, invalid = 0, times, question;
printf("Gente a entrevistar: ");
scanf("%i", ×);
printf("Escribe un numero: DC (1), Marvel (2), Salir del programa (0)\n");
for (int a = 1; a < times + 1; a++) {
printf("Persona %d: ", a);
scanf("%i", &question);
if (question == 0) {
a = times;
} else if (question == 1) {
dc++;
} else if (question == 2) {
marvel++;
} else {
invalid++;
}
}
printf("Votos por DC: %i\n", dc);
printf("Votos por Marvel: %i\n", marvel);
printf("Votos no validos: %i\n", invalid);
sleep(5);
return 0;
}