输入X、H的值,根据公式输出F的值。简单明了的用c语言编写出来,谢谢了
公式 F=a*x+b+c(H)其中,X、H为变量,F为输出值。a/b/c均为常数。a=0.46,b=29,c在不同区间取不同数值c的取值 当 H≤16 c=-7 当 16<H≤22 c=-6 当 22<H≤29 c=-5 当 29<H≤32 c=-2 当 32<H≤40 c=5 当 40<H≤48 c=19 当 H>48 c=25
#include <stdio.h>
#include <math.h>
int main ( )
{
double x,y;
printf("input x:");
scanf("%lf",&x);
if (x<1) y = 2*x+3;
else if (x>=10) y= sqrt( 3*x-4);
else y=2*x*x-1;
printf("y=%8.3f
",y);
return 0;
}
热门标签: