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;
int count =0;
float arr[50];
scanf("%f",&x);
while(scanf("%f",&value)!=EOF){
if(isalpha(value)!=0){
return 0;
}
if(count !=0){
arr[count-1]=value;
}
else{
x=value;
}
arr[count]=value;
count++;
}
value=0;
for(int i =0;i<count-1;i++){
value+=arr[i]*pow(x,count-2-i);
for(int i =0;i<count;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);