Code:
#include <iostream>
using namespace std;
int main()
{
cout << " ** Program to Check that given number is positive or negative** \n\n";
int num;
//taking user input
cout << "Enter any non-zero Number to be checked:\n ";
cin >> num;
//when the condition inside the if() is true, then it enters the code block
if (num > 0)
{
cout << "\nEntered number is positive";
}
else //when if is not executed then it moves to the else block
{
cout << "\nEntered number is negative";
}
cout << "\n\n\n";
return 0;
}
Output:
![](https://static.wixstatic.com/media/0f65e1_c4f9779d027746959e2b67ad5733b92d~mv2.png/v1/fill/w_90,h_15,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_c4f9779d027746959e2b67ad5733b92d~mv2.png)
![](https://static.wixstatic.com/media/0f65e1_2d3259145df640529484a95f4cf3e957~mv2.png/v1/fill/w_90,h_16,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/0f65e1_2d3259145df640529484a95f4cf3e957~mv2.png)
The Tech Platform