课堂作业3

#include<stdio.h>
int main(void)
{
	int i,n;
	double x,y;

	printf("Enter n:");
	scanf("%d",&n);

	for(i=1;i<=n;i++)
	{
		printf("Enter x:");
		scanf("%Lf",&x);

		if(x<=0)
		{
			printf("输入错误,重新输入");
		}
		else if(x<=50)
		{
			y=0.53*x;
		}
		else
		{
			y=26.5+0.58*(x-50);
		}
		printf("y=f(%f)=%.2f
",x,y);

		
	}
	return 0;
}
原文地址:https://www.cnblogs.com/lxhlxx900126/p/3373341.html