From 5ed55cd17aee703a19599088ef5590f3f59f8406 Mon Sep 17 00:00:00 2001 From: Andrii Hermaniuk Date: Thu, 10 Mar 2022 18:15:54 +0100 Subject: [PATCH] funguje --- du2/program.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 du2/program.c diff --git a/du2/program.c b/du2/program.c new file mode 100644 index 0000000..6a6418d --- /dev/null +++ b/du2/program.c @@ -0,0 +1,38 @@ +#include +#include +#define VELKOST_POLA 12 + + +int main(){ + + int value = 0; + + int pole[VELKOST_POLA]; + memset(pole,0,VELKOST_POLA*(sizeof(int))); + + int idx=0; + while (1){ + int r=scanf("%d",&value); + if(r!=1||idx==VELKOST_POLA){ + break; + } + pole[idx]=value; + idx++; + value++; + } + + if (value==0){ + printf("Error\n"); + return 0; + } + + int max_hodnota=0; + for(int i=0; i max_hodnota){ + max_hodnota = pole[i]; + } + } + printf("%d\n", max_hodnota); + + return 0; +}