38 lines
877 B
C
38 lines
877 B
C
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
|
|
int main() {
|
|
int results[50], count = 0, num, maxPoharov = 0;
|
|
|
|
while (scanf("%d", &num) == 1) {
|
|
if (num < 1 || num > 50) {
|
|
printf("Chyba: Neplatné číslo.\n");
|
|
return 0;
|
|
}
|
|
if (count >= 50) {
|
|
break;
|
|
}
|
|
results[count++] = num;
|
|
}
|
|
|
|
if (count == 0) {
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
|
return 0;
|
|
}
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i + 1, results[i]);
|
|
if (results[i] > maxPoharov) {
|
|
maxPoharov = results[i];
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|