1. Write a program to check whether a number is negative, positive or zero.

SOURCE CODE :

#include<iostream>
using namespace std;

int main ()
{
int num;

cout<<“Enter a number: “;
cin>>num;

if(num<0)
cout<<“Negative”;
else if(num==0)
cout<<“Zero”;
else
cout<<“Positive”;

return 0;
}

OUTPUT :

 

 

 

Questions