pvjc20/a1/program.c

30 lines
529 B
C
Raw Normal View History

2020-03-13 17:36:17 +00:00
#include <stdio.h>
#include<ctype.h>
#include<math.h>
int main()
{
2020-03-14 21:00:38 +00:00
double x=0;
double value =0;
2020-03-13 17:36:17 +00:00
int count =0;
2020-03-14 21:00:38 +00:00
double arr[50];
while(scanf("%lF",&value)!=EOF){
2020-03-13 17:36:17 +00:00
if(isalpha(value)!=0){
return 0;
}
if(count !=0){
arr[count-1]=value;
}
else{
x=value;
}
count++;
}
value=0;
for(int i =0;i<count-1;i++){
2020-03-13 17:36:49 +00:00
value+=arr[i]*pow(x,count-2-i);
2020-03-13 17:36:17 +00:00
}
2020-03-14 21:00:38 +00:00
printf("Vysledok je :%.2F\n",value);
2020-03-13 17:36:17 +00:00
return 0;
2020-03-13 17:30:16 +00:00
}