2024-02-27 14:10:58 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int main() {
|
2024-02-29 10:18:27 +00:00
|
|
|
int results[50];
|
|
|
|
int count = 0, num;
|
|
|
|
int maxPoharov = 0;
|
2024-02-27 14:10:58 +00:00
|
|
|
|
2024-02-29 09:30:25 +00:00
|
|
|
while (count < 50 && scanf("%d", &num) == 1) {
|
2024-02-29 10:18:27 +00:00
|
|
|
if (num <= 0) {
|
|
|
|
break;
|
2024-02-27 14:10:58 +00:00
|
|
|
}
|
2024-02-29 10:18:27 +00:00
|
|
|
results[count] = num;
|
2024-02-29 09:32:05 +00:00
|
|
|
if (num > maxPoharov) {
|
|
|
|
maxPoharov = num;
|
|
|
|
}
|
2024-02-29 10:18:27 +00:00
|
|
|
count++;
|
2024-02-27 14:10:58 +00:00
|
|
|
}
|
|
|
|
|
2024-02-29 10:20:41 +00:00
|
|
|
|
|
|
|
if (count == 0) {
|
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
|
|
|
return 0; // Ukončí program
|
|
|
|
}
|
|
|
|
|
2024-02-27 14:10:58 +00:00
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
|
|
|
|
}
|
|
|
|
|
2024-02-29 10:20:41 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
if (results[i] == maxPoharov) {
|
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, maxPoharov);
|
2024-02-27 14:10:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|