题解 | #计算单位阶跃函数#

计算单位阶跃函数

https://www.nowcoder.com/practice/0b23793ae48a4e6cb7dfff042c959a04

#include <stdio.h>

int main() {
    int t=0;
   
    while( scanf("%d",&t)!=EOF)
    {
        if(t>0)
    {
        printf("%d\n",1);
    }
    else if(t==0)
    {
        printf("%.1f\n",0.5);
    }
    else if(t<0)
    {
        printf("%d\n",0);
    } 
    }
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务