//7. 计算分段函数:
// {1/x(x≠0)
//y=f(x)={
// {0(x=0)
#include <stdio.h>
main()
{
float x=0.0;
scanf("%f",&x);
if(x!=0)
printf("%.2f\n",1/x);
else
printf("%.2f\n",x);
return 0;
}
运行结果:
如有错误,欢迎指出
//7. 计算分段函数:
// {1/x(x≠0)
//y=f(x)={
// {0(x=0)
#include <stdio.h>
main()
{
float x=0.0;
scanf("%f",&x);
if(x!=0)
printf("%.2f\n",1/x);
else
printf("%.2f\n",x);
return 0;
}
运行结果:
如有错误,欢迎指出