Wednesday, 8 July 2015

Write a c++ program that tell us the number is positive or negative

#include<iostream>
using namespace std;
int main()
{
int a;
cout<<"enter a num: ";
cin>>a;
if(a>0){
cout<<"num is Positive:"<<endl;
}else
if(a<0){
cout<<"num is -ve: "<<endl;

}else
cout<<"num is zero"<<endl;
}

0 comments:

Post a Comment