2022-03-10 17:15:54 +00:00
|
|
|
#include<stdio.h>
|
|
|
|
#include<string.h>
|
2022-03-10 17:38:23 +00:00
|
|
|
#define VELKOST_POLA 90
|
2022-03-10 17:15:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
int main(){
|
|
|
|
|
|
|
|
int value = 0;
|
2022-03-10 17:50:57 +00:00
|
|
|
int count = 0;
|
2022-03-10 17:15:54 +00:00
|
|
|
|
|
|
|
int pole[VELKOST_POLA];
|
|
|
|
memset(pole,0,VELKOST_POLA*(sizeof(int)));
|
2022-03-10 17:24:43 +00:00
|
|
|
|
|
|
|
int max_hodnota=0;
|
2022-03-10 17:15:54 +00:00
|
|
|
int idx=0;
|
|
|
|
while (1){
|
|
|
|
int r=scanf("%d",&value);
|
2022-03-10 17:48:25 +00:00
|
|
|
if(r!=1 || idx==VELKOST_POLA || value < 0){
|
2022-03-10 17:15:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
pole[idx]=value;
|
2022-03-10 17:24:43 +00:00
|
|
|
if (pole[idx] > max_hodnota){
|
2022-03-10 17:26:26 +00:00
|
|
|
max_hodnota = pole[idx];
|
2022-03-10 17:24:43 +00:00
|
|
|
}
|
2022-03-10 17:15:54 +00:00
|
|
|
idx++;
|
2022-03-10 17:50:57 +00:00
|
|
|
count++;
|
2022-03-10 17:15:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (value==0){
|
2022-03-10 17:50:57 +00:00
|
|
|
printf("Chyba: Málo platných hodnôt.\n");
|
2022-03-10 17:15:54 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-03-10 17:24:43 +00:00
|
|
|
for(int i=0; i<VELKOST_POLA;i++){
|
2022-03-10 17:28:41 +00:00
|
|
|
if(pole[i]>0){
|
2022-03-10 17:32:31 +00:00
|
|
|
printf("Súťažiaci č. %d vypil %d pohárov.\n", i+1, pole[i]);
|
2022-03-10 17:28:41 +00:00
|
|
|
}
|
2022-03-10 17:15:54 +00:00
|
|
|
}
|
2022-03-10 17:24:43 +00:00
|
|
|
|
2022-03-10 17:36:51 +00:00
|
|
|
for(int i=0; i<VELKOST_POLA;i++){
|
|
|
|
if(pole[i]==max_hodnota){
|
|
|
|
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",i+1, max_hodnota);
|
|
|
|
}
|
|
|
|
}
|
2022-03-10 17:15:54 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|