This commit is contained in:
Peter Sabol 2022-03-10 20:30:17 +01:00
parent c98475792c
commit 3f0c3eeeca
2 changed files with 4 additions and 4 deletions

BIN
du2/program Executable file

Binary file not shown.

View File

@ -10,18 +10,18 @@ int main(){
int drinks_counter[VELKOST_POLA];
int i=0;
while(i<VELKOST_POLA){
scanf("%d",drinks_counter[i]);
if(drink_counter[i]<1){
scanf("%d",&drinks_counter[i]);
if(drinks_counter[i]<1){
break;
}
i++;
}
struct Winner max={0,0};
for(int j=0;j<i;j++){
printf("Súťažiaci č.%d vypil %d pohárov.\n",j,drinks_counter[j]);
printf("Súťažiaci č.%d vypil %d pohárov.\n",j+1,drinks_counter[j]);
if(drinks_counter[j]>max.drinks){
max.drinks=drinks_counter[j];
max.position=j;
max.position=j+1;
}
}
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max.position,max.drinks);