OCJP

Check if a Number is Positive, Negative or Zero

#include<stdio.h>
#include<conio.h>
void main()
{int n;

clrscr();
printf("enter value of  N:");
scanf("%d",&n);
 if(n<0)
 {
 printf("\nN is Negative");
 }
else if(n>0)
 {
 printf("\nN is Positive");
 }
 else
 {
 printf("\nN is Zero");
 }

getch();
}

OUTPUT

Leave a Reply

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


Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.
× How can I help you?
Comodo SSL