1-4-01:判断数正负

时间:2015-11-28 18:11:55   收藏:0   阅读:2536

描述

给定一个整数N,判断其正负。

 

输入一个整数N(-109 <= N <= 109)输出如果N > 0, 输出positive;
如果N = 0, 输出zero;
如果N < 0, 输出negative样例输入

1

样例输出

positive
#include<stdio.h>
int main()
{
    int n;
    scanf("%d",&n);
    if(n>=0)
        if(n==0)
            printf("zero");
        else 
            printf("positive");
    else 
        printf("negative");
    return 0;
}

 

原文:http://www.cnblogs.com/MicahelOD/p/5002895.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!