Program in C++ to check whether a number is a positive number, negative number or zero.

In the above C++ program to check whether the number is positive, negative or zero, We are using if condition since any number that is more than 0 will be positive and less than 0 will be negative.

#include <iostream>
using namespace std;

int main()
{
    signed long num1 = 0;
    cout << "\n\n Check whether a number is positive, negative or zero :\n";
    cout << "-----------------------------------------------------------\n";
    cout << " Enter a number : ";
    cin >> num1;
    if(num1 > 0)
    {
        cout << " The entered number is positive.\n\n";
    }
    else if(num1 < 0)
    {
        cout << " The entered number is negative.\n\n";
    }
    else
    {
        std::cout << " The number is zero.\n\n";
    }
    return 0;
}
Sample Output:
Enter a number : 34
The entered number is positive.