NOIP信息学 1039:判断数正负--信息学一本通(c++)

时间:2020-04-07 13:20:57   收藏:0   阅读:179

时间限制: 1000 ms 内存限制: 65536 KB
提交数: 34909 通过数: 17501
【题目描述】
给定一个整数N,判断其正负。如果N>0,输出positive;如果N=0,输出zero;如果N<0,输出negative。

【输入】
一个整数N(−109≤N≤109)。

【输出】
如果N>0, 输出positive;

如果N=0, 输出zero;

如果N<0, 输出negative。

【输入样例】
1
【输出样例】
positive
【来源】

No

代码如下:
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
    int N;
    cin >> N;
    if (N > 0) cout << "positive" << endl;
    else if (N == 0) cout << "zero" << endl;
    else cout << "negative" << endl;
    return 0;
}

  

  NOIP视频地址

https://pan.baidu.com/s/1fAuVscWNdApIGmKZK4Wb6Q 
提取码:u56x

原文:https://www.cnblogs.com/yyjy-edu/p/12652686.html

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