41 lines
809 B
C
41 lines
809 B
C
#include <stdio.h>
|
|
#define VELKOST_POLA 50
|
|
|
|
int main()
|
|
{
|
|
int pole[VELKOST_POLA] = {0,0,0,0};
|
|
|
|
int i = 0, max_hodnota = 0, value = 0;
|
|
|
|
while(value >= 0 || i <= 49 || value != EOF){
|
|
int r = scanf("%d",&value);
|
|
|
|
if(value <= -1){
|
|
break;
|
|
}
|
|
|
|
if(max_hodnota < value){
|
|
max_hodnota = value;
|
|
}
|
|
|
|
if(r == 1){
|
|
pole[i] = value;
|
|
i++;
|
|
|
|
fprintf(stdout, "Súťažiaci č. %d vypil %d pohárov.\n", i, pole[i-1]);
|
|
} else{
|
|
break;
|
|
}
|
|
}
|
|
|
|
for(;i >= 0; i--){
|
|
if(pole[i] == max_hodnota){
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", i+1, pole[i]);
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
|