From 7d616ee905ab72cec230b7eada2ed76f6debc32c Mon Sep 17 00:00:00 2001 From: Bohdan Yanchyk Date: Sun, 15 Mar 2020 17:35:40 +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 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/a1/program.c b/a1/program.c index c2878fa..22623df 100644 --- a/a1/program.c +++ b/a1/program.c @@ -3,12 +3,12 @@ #include int main() { - float x=0; - double value =0; + double x=0; + long double value =0; int count =0; double arr[50]; - scanf("%f",&x); - while(scanf("%lf",&value)!=EOF){ + scanf("%lf",&x); + while(scanf("%Lf",&value)!=EOF){ if(isalpha(value)!=0){ return 0; } @@ -20,10 +20,10 @@ int main() value+=arr[i]*pow(x,count-1-i); } - //if(value>=40000){ - // value =((int)(value*100 - 0.5)/100.00); - // } - printf("Vysledok je :%.2lf\n",value); + if(value>=40000){ + value =((int)(value*100 - 0.5)/100.00); + } + printf("Vysledok je :%Lf\n",value); return 0;