From d1e831890c59dbd16d1541e86c26f60b8b401ab2 Mon Sep 17 00:00:00 2001 From: Patrik Seman Date: Sat, 4 Mar 2023 12:54:22 +0100 Subject: [PATCH] . --- du2/program.c | 52 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/du2/program.c b/du2/program.c index ee44a79..9e2032a 100644 --- a/du2/program.c +++ b/du2/program.c @@ -1,35 +1,33 @@ #include #include -#include - #define VELKOST_POLA 52 - int main(){ - int i = 0; + int i=0; int pole[VELKOST_POLA]; - memset(pole, 0, VELKOST_POLA * sizeof(int)); - int max_hodnota = 0; + memset(pole,0,VELKOST_POLA * sizeof(int)); + int max_hodnota=0; int max_hrac = 0; - int value = 0; - int r = 0; - - while(i < VELKOST_POLA){ - value = 0; - r = scanf("%d", &value); - pole[i] = value; - - if(r == 1){ - i++; - printf("Súťažiaci č. %d vypil %d pohárov.\n", i, value); - - if(value > max_hodnota){ - max_hodnota = value; - max_hrac = i; - } - } - else{ - break; - } + int value=0; + int r=0; +while(i max_hodnota){ + max_hodnota = pole[i]; + max_hrac = i; +} +i++; + + +} +printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n", max_hrac,max_hodnota); } \ No newline at end of file