C Program to Check Whether Number is Positive, Negative or Zero

Q.: Write C Program to Determine Whether given number is positive, negative or zero using if…else statement.

We can check multiple conditions like three conditions using nested if else in C Programming.

Source Code:

#include<stdio.h>
#include<conio.h>

void main()
{
	int no;
	clrscr();
	printf("nnt Enter Any Number : ");
	scanf("%d",&no);
	if(no>0)
	{
		printf("nnt Given Number is Positive !");
	}
	else if(no<0)
	{
		printf("nnt Given Number is Negative !");
	}
	else
	{
		printf("nnt Number is Zero !");
	}
	getch();
}

Output:

Check Number is Positive or Negative or Zero

Fig. : Check Number is Positive or Negative or Zero

Version : Turbo C++ Version 3.0 (Borland International, Inc.)

Download Now (.Zip File – 19KB)…

2 Comments

0 Trackbacks

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.