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 *


× How can I help you?