1039:判断数正负
# 题目描述
给定一个整数 positive;如果 zero;如果 negative。
# 输入
一个整数
# 输出
如果positive;
如果zero;
如果negative。
# 样例
# 输入样例
1
1
# 输出样例
positive
1
# 源代码
#include <iostream>
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;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
上次更新: 2022/03/08, 01:01:22


