#include #define VELKOST_POLA 50 int main() { int result[VELKOST_POLA] = {0,0,0,0}; int b = 1; int best = 0; int count = 0; int max = 0; while (scanf("%d", &result[count]) == 1 && count < VELKOST_POLA) { if (result[count] < 1) { printf("Chyba: Neplatne cislo.\n"); return 1; } count++; } max = result[0]; for(int c = 1;c < VELKOST_POLA;c++){ if(result[c] > max){ max = result[c]; best = c + 1; } } if(count == 0){ printf("Chyba: Málo platných hodnôt.\n"); return 1; } for(int c = 0;c < VELKOST_POLA+1;c++){ printf("Súťažiaci č. %d vypil %d pohárov.\n", c + 1,result[c]); } printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",best,max); return 0; }