pvjc20/a1/program.c

30 lines
543 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:21:18 +00:00
float x=0;
2020-03-15 17:30:33 +00:00
double value =0;
2020-03-13 17:36:17 +00:00
int count =0;
2020-03-15 17:30:33 +00:00
double arr[50];
2020-03-15 17:22:58 +00:00
scanf("%f",&x);
2020-03-15 17:30:33 +00:00
while(scanf("%lf",&value)!=EOF){
2020-03-13 17:36:17 +00:00
if(isalpha(value)!=0){
return 0;
}
2020-03-15 17:22:58 +00:00
arr[count]=value;
2020-03-13 17:36:17 +00:00
count++;
}
value=0;
2020-03-15 17:22:58 +00:00
for(int i =0;i<count;i++){
2020-03-15 17:24:04 +00:00
value+=arr[i]*pow(x,count-1-i);
2020-03-15 17:22:58 +00:00
}
2020-03-15 17:30:33 +00:00
//if(value>=40000){
// value =((int)(value*100 - 0.5)/100.00);
// }
printf("Vysledok je :%.2lf\n",value);
2020-03-13 17:36:17 +00:00
return 0;
2020-03-13 17:30:16 +00:00
}