# Check If A Number Is Positive Or Negative Using C++

You may have read many articles but I hope the Check If A Number Is Positive Or Negative Using C++ article will satisfy all your doubts. The reason for that is that I have written this article in such a way as to satisfy all your doubts.

A number is said to be positive if it is greater than zero and it is said to be negative if it is less than zero. A number can be checked for zero, positive and negative using if, if-else, nested if-else, and short-hand if-else statements.

Problem Solution

1. The program takes a number.
2. It is checked if it is positive or negative.
3. The result is printed.
4. Exit.

```           Examples

Input 1 : 67
Output 1 : 67> 0. So 67 is a Positive number

Input 2 : -67
Output 1 : -67< 0. So 67 is a Negative number
```

## Check if a Number is Positive or Negative using C++

``````#include<iostream>
using namespace std;
int main ()
{
int num;
cout << "Enter the number to be checked : ";
cin >> num;
if (num >= 0)
cout << num << " is a positive number.";
else
cout << num << " is a negative number.";
return 0;
}``````

Read Also: Calculate Grade Of Student Using C++

## Output

``````Case 1 :
Enter the number to be checked : -8
-8 is a negative number.

Case 2 :
Enter the number to be checked : 0
0 is a positive number.

Case 2 :
Enter the number to be checked : 125
125 is a positive number.``````

## Final Words

Check If A Number Is Positive Or Negative Using C++ We hope all your doubts have been resolved through this article. Also if you need any information you can let us know your doubts in the comment box.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Deekshi. Here, I post about programming to help developers.

Share on: