(1)设f(x) = xx + x/2.1–8;g(x) = 2f(x) – 3.5f(2x) + 5.5;编程序,对x=-5,-4,-3,…,3,4,5,计算各g(x)之值并输出这11个计算结果。
```c
#include <stdio.h>
float f(int x) {
return x *x + x / 2.1 - 8 ;
}
float g (int x ) {
return 2 * f(x) - 3.5 * f(2*x) + 5.5 ;
}
int main(){
int x ;
for (x=-5 ; x<=5; ++x){
printf("当x=%d, g = %f\n", x, g(x));
}
}
```