From 5ec42c6cad3deab3c9d9b4177bcea8eee23480d7 Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Mon, 2 Mar 2020 13:52:42 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Edu2/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du2/program.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/du2/program.c b/du2/program.c index 65ca495..1464927 100644 --- a/du2/program.c +++ b/du2/program.c @@ -1,4 +1,29 @@ -#include -int main(){ -return 0; +#include +#define VELKOST_POLA 12 + +int main() +{ + int value = 0; + int pole[VELKOST_POLA] = {0,0,0,0}; + int r = 0; + int i = 0; + int max_hodnota = pole[0]; + + while (r = scanf("%d",&value)){ + pole[i] = value; + i++; + } + + int len = (sizeof(pole)/sizeof(*pole)); + + for(i = 0; i < len; i++){ + if(pole[i] > max_hodnota){ + max_hodnota = pole[i]; + } + } + + printf("%d", max_hodnota); + + return 0; } +