43 lines
861 B
C
43 lines
861 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int main() {
|
|
int results[50];
|
|
int count = 0;
|
|
int value;
|
|
|
|
while (scanf("%d", &value) == 1) {
|
|
if (value < 1) {
|
|
break;
|
|
}
|
|
if (count >= 50) {
|
|
break;
|
|
}
|
|
results[count++] = value;
|
|
}
|
|
|
|
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]);
|
|
}
|
|
|
|
int max = results[0];
|
|
for (int i = 1; i < count; i++) {
|
|
if (results[i] > max) {
|
|
max = results[i];
|
|
}
|
|
}
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
if (results[i] == max) {
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i + 1, max);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|