Tuesday, 17 June 2014

C++ program to check whether a number is positive or negative



Here is a C++ program to check whether a number is positive or negative


 SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
    int n;
    cout<<"Enter the number ";
    cin>>n;
    if(n>=0)
        cout<<"Number is positive";
    else
        cout<<"Number is negative";
    return 0;
}

Any questions regarding to program please write in comments.

No comments:

Post a Comment