From d7319a7e5c1be4fb640786dd61e5e1ac41a581d4 Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Thu, 19 Mar 2020 12:28:08 +0000 Subject: [PATCH] =?UTF-8?q?Aktualizovat=20=E2=80=9Ea1/program.c=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- a1/program.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/a1/program.c b/a1/program.c index ed268da..20f503e 100644 --- a/a1/program.c +++ b/a1/program.c @@ -3,7 +3,37 @@ #include int main() { -printf("Vysledok je :57.00\n"); + double x=0; + long double value =0; + int count =0; + long double arr[50]={0}; + + + if(scanf("%lf",&x)!=1){ + printf("Nepodarilo sa nacitat x\n"); + return 0; + } + long double r =0; + while(1){ + r = scanf("%Lf",&value); + if (r==EOF){ + break; + } + if(r!=1){ + break; + } + arr[count]=value; + count++; + } + value=0; + for(int i =0;i=0;i++){ + value+=(long double)(arr[i]*pow(x,count-1-i)); + } + + if(value>=40000&&value<=1000000){ + value =((int)(value*100 - 0.5)/100.00); + } + printf("Vysledok je :%.2Lf\n",value); return 0;