pvjc22/du2/program.c

29 lines
633 B
C
Raw Normal View History

2022-03-09 07:57:33 +00:00
#include <stdio.h>
2022-03-10 18:33:38 +00:00
#include <stdlib.h>
2022-03-09 07:57:33 +00:00
#define VELKOST_POLA 52
2022-03-10 19:23:56 +00:00
struct Winner{
int drinks,position;
};
2022-03-09 07:58:54 +00:00
int main(){
2022-03-10 19:23:56 +00:00
int drinks_counter[VELKOST_POLA];
int i=0;
while(i<VELKOST_POLA){
scanf("%d",drinks_counter[i]);
if(drink_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]);
if(drinks_counter[j]>max.drinks){
max.drinks=drinks_counter[j];
max.position=j;
2022-03-09 08:26:32 +00:00
}
}
2022-03-10 19:23:56 +00:00
printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",max.position,max.drinks);
2022-03-10 11:23:37 +00:00
return 0;
2022-03-05 16:27:11 +00:00
}