Write a program to check positive or negative numbers.


/* Write a program to check positive or negative numbers.*/

#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

int num;

clrscr();

cout<<“enter a number=”;

cin>>num;

if(num>0)

{

cout<<“number is positive”;

}

else if(num<0)

{

cout<<“number is negative”;

}

else

{

cout<<“number is zero”;

}

getch();

}

output:

enter  a number=4

the number is positive

enter a number=0

the number is zero

enter a number=-4

the number is negative

Related Posts

Comments are closed.