2025-02-27 17:19:02 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
int main() {
|
2025-02-27 17:47:36 +00:00
|
|
|
int results[50];
|
2025-02-27 17:19:02 +00:00
|
|
|
int count = 0;
|
2025-02-27 17:47:36 +00:00
|
|
|
int value;
|
|
|
|
|
|
|
|
while (scanf("%d", &value) == 1) {
|
|
|
|
if (value < 1) {
|
2025-02-27 17:19:02 +00:00
|
|
|
break;
|
|
|
|
}
|
2025-02-27 17:47:36 +00:00
|
|
|
if (count >= 50) {
|
|
|
|
break;
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
2025-02-27 18:19:37 +00:00
|
|
|
results[count++] = value;
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (count == 0) {
|
2025-02-27 18:10:47 +00:00
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
2025-02-27 18:29:05 +00:00
|
|
|
return 0;
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
2025-02-27 18:10:47 +00:00
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
|
|
|
|
2025-02-27 17:47:36 +00:00
|
|
|
int max = results[0];
|
|
|
|
for (int i = 1; i < count; i++) {
|
|
|
|
if (results[i] > max) {
|
|
|
|
max = results[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-02-27 17:19:02 +00:00
|
|
|
for (int i = 0; i < count; i++) {
|
2025-02-27 17:47:36 +00:00
|
|
|
if (results[i] == max) {
|
2025-02-27 18:23:27 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, max);
|
2025-02-27 17:19:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|