From e529ce698bb0608a34d6e3e8e8403ab926d81629 Mon Sep 17 00:00:00 2001 From: Vladyslav Korzun Date: Thu, 2 Mar 2023 10:39:59 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'du3/program.c'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- du3/program.c | 52 +-------------------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/du3/program.c b/du3/program.c index f50423e..164af8c 100644 --- a/du3/program.c +++ b/du3/program.c @@ -1,100 +1,50 @@ #include - #include - #include - #include - #include - #include - #define LINE_SIZE 150 - int main(){ - char riadok[LINE_SIZE]; - memset(riadok, 0,LINE_SIZE); - char* r; - float r2; - int stop = 0; - float mass[LINE_SIZE]; - int i = 0; - float x = 0; - float vysl = 0; - int counter = -1; - float h = 0; - //float p = 0; - while(stop == 0){ - r = fgets(riadok,LINE_SIZE,stdin); - if (r == NULL || !isdigit(*r)) { - - break; - + stop = 1; } - r2 = atof(riadok); - mass[i] = r2; - //printf("%.2f\n", r2); - i++; - } - x = mass[0]; - vysl = x; - //printf("%d\n", x); - for(int j = 1; j < i - 1; j++){ - h = mass[j]; - //printf("h>>> %1.f\n", h); - if(counter == -1){ - vysl = x * h + mass[j + 1]; - //printf("vysl>>> %1.f\n", vysl); - counter++; - } - else{ - if(j != i - 2){ - vysl = x * vysl + mass[j + 1]; - //printf("vysl22>>>>> %1.f\n", vysl); - } - } - } - printf("Vysledok je: %.2f\n", vysl); - } -