分段函数求值

    xiaoxiao2023-03-25  5

    问题及代码:

    #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { int x,y; printf("请输入x的值:"); scanf("%d",&x); if (x<2) y=x; else if(2<=x<6) y=x*x+1; else if(6<=x<10) y=sqrt(x+1); else y=1/(x+1); printf("%d",y); return 0; }

    运行结果

    转载请注明原文地址: https://ju.6miu.com/read-1204005.html
    最新回复(0)