mirror of
https://github.com/renbaoshuo/202401-programming-assignments.git
synced 2024-11-23 15:48:42 +00:00
12 lines
180 B
C
12 lines
180 B
C
|
double f(int n, double a[], double x) {
|
||
|
double res = 0;
|
||
|
double k = 1;
|
||
|
|
||
|
for (int i = 0; i <= n; i++) {
|
||
|
res += a[i] * k;
|
||
|
k *= x;
|
||
|
}
|
||
|
|
||
|
return res;
|
||
|
}
|