小白入门.有函数F(x)=(x+1)^2和G(x)=2x+1.输入x值计算F(G(x))。

#include<stdio.h>
#include<math.h>
void main()
{
	float x,y;
	printf("Please input x\n");
	scanf("%f",&x);
	y=2*x+1;
	y=(float)pow(y+1,2);
	printf("%f",y);
}

用到了平方,需要加上标准数学库函数#include<math.h>

猜你喜欢

转载自www.cnblogs.com/nanaa/p/10962232.html