38 lines
659 B
C
38 lines
659 B
C
#include <stdio.h>
|
|
#define VELKOST_POLA 50
|
|
|
|
int main(){
|
|
int results[VELKOST_POLA];
|
|
int max;
|
|
int i = 0;
|
|
int first;
|
|
int a = 0;
|
|
while(1){
|
|
int value = 0;
|
|
int r = scanf("%d",&value);
|
|
if (r == 1){
|
|
results[i] = value;
|
|
max = results[0];
|
|
if(max < results[i]){
|
|
max = results[i];
|
|
first = i + 1;
|
|
}
|
|
i++;
|
|
}else if(i == 0){
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
|
}else{
|
|
break;
|
|
}
|
|
}
|
|
do{
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n",a+1,results[a]);
|
|
if(a == i - 1){
|
|
a = first - 1;
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",a+1,max);
|
|
break;
|
|
}
|
|
a++;
|
|
}while(a < i);
|
|
return 0;
|
|
}
|