2025-02-20 19:13:55 +00:00
|
|
|
#include <stdio.h>
|
2025-02-21 12:00:24 +00:00
|
|
|
#define maxcol 50
|
2025-02-20 19:13:55 +00:00
|
|
|
|
|
|
|
int main() {
|
2025-02-21 12:00:24 +00:00
|
|
|
int results[maxcol];
|
|
|
|
int count = 0;
|
|
|
|
int num;
|
|
|
|
|
|
|
|
while (count < maxcol && scanf("%d", &num) == 1) {
|
|
|
|
if (num < 1) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
results[count] = num;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (count == 0) {
|
2025-02-21 12:03:53 +00:00
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
2025-02-21 12:06:05 +00:00
|
|
|
return 0;
|
2025-02-21 12:00:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
2025-02-21 12:03:53 +00:00
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n",i+1,results[i]);
|
2025-02-21 12:00:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int max_value = results[0];
|
|
|
|
for (int i = 1; i < count; i++) {
|
|
|
|
if (results[i] > max_value) {
|
|
|
|
max_value = results[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
if (results[i] == max_value) {
|
2025-02-21 12:03:53 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",i+1,results[i]);
|
2025-02-21 12:00:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|