From 51a7d14338a3176bb929738e0f1ef0eddaca1349 Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Sun, 15 Mar 2020 18:21:16 +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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/a1/program.c b/a1/program.c index 278dc72..7d3ff6e 100644 --- a/a1/program.c +++ b/a1/program.c @@ -13,16 +13,17 @@ int main() printf("Nepodarilo sa nacitat x\n"); return 0; } - while(scanf("%Lf",&value)!=EOF){ - + int r =0; + while((r=scanf("%Lf",&value)!=EOF)&&r==1){ arr[count]=value; count++; } value=0; - for(int i =0;i=0;i++){ - value+=(long double)(arr[i]*pow(x,count-1-i)); + if(r==1){ + 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); }