Aktualizovat „a1/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-03-15 18:21:16 +00:00
parent 1cfec89bcd
commit 51a7d14338

View File

@ -13,16 +13,17 @@ int main()
printf("Nepodarilo sa nacitat x\n"); printf("Nepodarilo sa nacitat x\n");
return 0; return 0;
} }
while(scanf("%Lf",&value)!=EOF){ int r =0;
while((r=scanf("%Lf",&value)!=EOF)&&r==1){
arr[count]=value; arr[count]=value;
count++; count++;
} }
value=0; value=0;
if(r==1){
for(int i =0;i<count&&count-1-i>=0;i++){ for(int i =0;i<count&&count-1-i>=0;i++){
value+=(long double)(arr[i]*pow(x,count-1-i)); value+=(long double)(arr[i]*pow(x,count-1-i));
} }
}
if(value>=40000&&value<=1000000){ if(value>=40000&&value<=1000000){
value =((int)(value*100 - 0.5)/100.00); value =((int)(value*100 - 0.5)/100.00);
} }