2022-03-08 14:34:11 +00:00
|
|
|
#include <stdio.h>
|
2022-03-09 12:53:51 +00:00
|
|
|
#define VELKOST_POLA 50
|
2022-03-08 14:34:11 +00:00
|
|
|
|
|
|
|
int main(){
|
2022-03-09 12:53:51 +00:00
|
|
|
int results[VELKOST_POLA];
|
2022-03-09 13:18:13 +00:00
|
|
|
int max = results[0];
|
2022-03-08 14:34:11 +00:00
|
|
|
int i = 0;
|
2022-03-09 13:18:13 +00:00
|
|
|
int first;
|
2022-03-09 12:53:51 +00:00
|
|
|
int a = 0;
|
2022-03-08 14:34:11 +00:00
|
|
|
while(1){
|
2022-03-09 12:53:51 +00:00
|
|
|
int value = 0;
|
|
|
|
int r = scanf("%d",&value);
|
|
|
|
if (r == 1){
|
|
|
|
results[i] = value;
|
2022-03-09 13:18:13 +00:00
|
|
|
if(max < results[i]){
|
2022-03-09 13:14:04 +00:00
|
|
|
max = results[i];
|
2022-03-09 13:18:13 +00:00
|
|
|
first = i + 1;
|
|
|
|
}
|
2022-03-09 12:53:51 +00:00
|
|
|
i++;
|
2022-03-09 13:08:37 +00:00
|
|
|
}else if(i == 0){
|
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
2022-03-09 12:53:51 +00:00
|
|
|
}else{
|
|
|
|
break;
|
|
|
|
}
|
2022-03-09 12:59:22 +00:00
|
|
|
}
|
|
|
|
do{
|
2022-03-09 13:12:36 +00:00
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n",a+1,results[a]);
|
2022-03-09 12:59:22 +00:00
|
|
|
if(a == i - 1){
|
2022-03-09 13:20:12 +00:00
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",a+1,max);
|
2022-03-09 12:59:22 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
a++;
|
|
|
|
}while(a < i);
|
2022-03-08 14:34:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|