1039:判断数正负

1039:判断数正负

【题目描述】

给定一个整数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 <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	
	cin >> N;
		
	if(N > 0)	cout<<"positive";
	
	if(N == 0) 	cout<<"zero";
	
	if(N < 0)	cout<<"negative";
	
	return 0;
}

【问题难点】

主要考察对于 if 的使用是否了解



posted @ 2021-02-12 20:59  春暖花开鸟  阅读(953)  评论(0编辑  收藏  举报