Positive, Negative and Zero

Write a Program to check whether given number is Positive, Negative and Zero.


Source Code:

#include<stdio.h>
#include<conio.h>
void main()
{
	int no;
	clrscr();
	printf("Enter the number:");
	scanf("%d",&no);
	if(no>0)
	{
		printf("The number is positive:");
	}
	if(no<0)
	{
		printf("The number is negative:");
	}
	if(no==0)
	{
		printf("The number is zero");
	}
	getch();
}
Output:

Enter the number: 10
The number is positive.

Enter the number: -10
The number is negative.

Enter the number: 0
The number is zero.

Leave a Reply

Your email address will not be published. Required fields are marked *