分段函数求值

#include <stdio.h>
int main()
{
    double x, y;
    while(scanf("%lf",&x)!=EOF)
    {
        if(x > 0)
        {
            y = x * x + 1;
        }
        else if(x < 0)
        {
            y = -x;
        }
        else if(x == 0)
        {
            y = 100.0;
        }
        printf("%.1lf\n",y);
    }
    return 0;
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2021-12-17
  • 2021-08-31
  • 2021-11-17
  • 2022-12-23
猜你喜欢
  • 2021-11-21
  • 2021-06-16
  • 2022-12-23
  • 2021-12-06
  • 2021-06-01
  • 2021-08-05
相关资源
相似解决方案