1039:判断数正负
时间限制: 1000 ms 内存限制: 65536 KB
提交数: 95377 通过数: 47991
【题目描述】
给定一个整数NN,判断其正负。如果N>0N>0,输出positive
;如果N=0N=0,输出zero
;如果N<0N<0,输出negative
。
【输入】
一个整数N(−109≤N≤109)N(−109≤N≤109)。
【输出】
如果N>0N>0, 输出positive
;
如果N=0N=0, 输出zero
;
如果N<0N<0, 输出negative
。
【输入样例】
1
【输出样例】
positive
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
if(n>0)
{
cout<<"positive";
}
if(n==0)
{
cout<<"zero";
}
if(n<0)
{
cout<<"negative";
}
}