#include<math.h>
#include<stdio.h>
int main()
{
float x,y;
scanf("%f",&x);
if(x>=0)
{
y=sqrt(x);
}
else y=(x+1)*(x+1)+2*x+1/x;
printf("f(x)=%.2f",y);
return 0;
}
#include<math.h>
#include<stdio.h>
int main()
{
float x,y;
scanf("%f",&x);
if(x>=0)
{
y=sqrt(x);
}
else y=(x+1)*(x+1)+2*x+1/x;
printf("f(x)=%.2f",y);
return 0;
}
本文标题:练习2-4-5 :计算分段函数(顺序、简单分支结构)
本文链接:https://www.haomeiwen.com/subject/zvedqrtx.html
网友评论