From 1d1236d726325a10f68d52481b07c794379df543 Mon Sep 17 00:00:00 2001 From: Pavlo Tverdyi Date: Sat, 7 Mar 2020 14:16:14 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20'du2/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du2/program.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/du2/program.c b/du2/program.c index e69de29..ed59f30 100644 --- a/du2/program.c +++ b/du2/program.c @@ -0,0 +1,37 @@ +#include +#define VELKOST_POLA 52 + + + +int main() +{ +int i=0; +int max_hodnota=0; +int pole[VELKOST_POLA] = {0,0,0,0}; + for(;i<=49;i++){ + int r = scanf("%d",&pole[i]); + if(r==EOF){ + break; + } + if(pole[i] <= 0){ + break; + } + printf("Súťažiaci č. %d vypil %d pohárov.\n",i+1,pole[i]); + if (pole[i] > max_hodnota){ + max_hodnota = pole[i]; + } + + } + if(pole[0]<=0){ + printf("Chyba: Málo platných hodnôt.\n"); + } + else{ + for(int j=0;j<=i;j++){ + if(pole[j]==max_hodnota){ + printf("Výherca je súťažiaci %d ktorý vypil %d pohárov.\n",j+1,pole[j]); + } + } + } + return 0; +} +