Aktualizovat „a1/program.c“

This commit is contained in:
Bohdan Yanchyk 2020-03-15 17:22:58 +00:00
parent 00eed37fdf
commit 81c0fd57a4

View File

@ -7,21 +7,21 @@ int main()
float value =0; float value =0;
int count =0; int count =0;
float arr[50]; float arr[50];
scanf("%f",&x);
while(scanf("%f",&value)!=EOF){ while(scanf("%f",&value)!=EOF){
if(isalpha(value)!=0){ if(isalpha(value)!=0){
return 0; return 0;
} }
if(count !=0){ arr[count]=value;
arr[count-1]=value;
}
else{
x=value;
}
count++; count++;
} }
value=0; value=0;
for(int i =0;i<count-1;i++){ for(int i =0;i<count;i++){
value+=arr[i]*pow(x,count-2-i); value+=arr[i]*pow(x,count-i);
}
if(value>=40000){
value =((int)(value*100 - 0.5)/100.00);
} }
printf("Vysledok je :%.2f\n",value); printf("Vysledok je :%.2f\n",value);