You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
305 B

int a[5];
int poly(int x)
{
int i=0;
int sum=0;
while(i<5)
{
sum = sum * x + a[4-i];
i = i + 1;
}
return sum;
}
int main()
{
int x;
x = getint();
int i = 0;
while(i < 5)
{
a[i] = getint();
i = i + 1;
}
return poly(x);
}