#include <stdio.h>
#include <math.h>
int main(void)
{
    float x,y;
    printf("请输入x的值:\n");
    scanf("%f",&x);
    if(x>0)
    {
        y=exp(-x);
    }    
    else if(x<0)
    {
        y=-exp(x);
    }
    else (y=1);
    printf("Input x: y=%f",y);
	return 0;
}

 

更多推荐

C语言分段函数程序(示例)