pvjc20/a1/program.c

33 lines
631 B
C

#include <stdio.h>
#include<ctype.h>
#include<math.h>
int main()
{
double x=0;
long double value =0;
int count =0;
long double arr[50]={0};
scanf("%lf",&x);
if(isalpha(x)!=0){
printf("Nepodarilo sa nacitat x\n");
return 0;
}
while(scanf("%Lf",&value)!=EOF){
arr[count]=value;
count++;
}
value=0;
for(int i =0;i<count&&count-1-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);
}
printf("Vysledok je :%.2Lf\n",value);
return 0;
}