diff --git a/du1/program.c b/du1/program.c index 3ac90d9..c72bf3b 100644 --- a/du1/program.c +++ b/du1/program.c @@ -1,6 +1,38 @@ #include -#define celyhodnoty 50 +#define maxcol 50 int main() { - return 0; -} \ No newline at end of file + int results[maxcol]; + int count = 0; + int num; + + while (count < maxcol && scanf("%d", &num) == 1) { + if (num < 1) { + break; + } + results[count] = num; + count++; + } + + if (count == 0) { + printf("Chyba. Malo platnych hodnot.\n"); + return 1; + } + + for (int i = 0; i < count; i++) { + printf("Sutaziaci c. %d vypil %d poharov.\n",i+1,results[i]); + } + + int max_value = results[0]; + for (int i = 1; i < count; i++) { + if (results[i] > max_value) { + max_value = results[i]; + } + } + for (int i = 0; i < count; i++) { + if (results[i] == max_value) { + printf("Vyherca je sutaziaci %d ktory vypil %d poharov.\n",i+1,results[i]); + } + } + return 0; +} diff --git a/du1/program.exe b/du1/program.exe index cfdfbb8..115ba80 100644 Binary files a/du1/program.exe and b/du1/program.exe differ