Answers for "check if number is positive or negative in cpp"

C++
0

check if number is positive or negative in cpp

// positive negative or zero

#include <iostream>
using namespace std;

int main()
{
    int num;

    cout<< "Enter the number: ";
    cin >> num;

    if(num>0)
        cout<< "Positive";
    else if (num<0)
        cout<< "Negative";
    else
        cout<< "Zero";

    return 0;
}
Posted by: Guest on February-03-2022

Code answers related to "check if number is positive or negative in cpp"

Browse Popular Code Answers by Language