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