Positive number
All the numbers greater than 0, but not equal to 0 are positive numbers.
Negative number
Similarly all the number less than 0, but not equal to 0 are negative numbers.
Logic
If the number is greater than zero that means it is positive. If the number is less than zero that means it is negative. If the number is equal to zero that means it is absolute zero.
- if number > 0 then print Positive.
- if number < 0 then print Negative.
- if number == 0 then print Zero.
Program
#include <iostream> using namespace std; int main() { int number; cout << "Enter any number : "; cin >> number; if(number > 0) { cout << endl << "POSITIVE NUMBER" << endl; } if(number < 0) { cout << endl << "NEGATIVE NUMBER" << endl; } if(number == 0) { cout << endl << "NUMBER IS ZERO" << endl; } return 0; }
Output
Enter any number : 101
POSITIVE NUMBER.