Write a C Program to check whether the number enter is positive, negative or zero
Write a C Program to check whether the number enter is positive, negative or zero
Here is the C Program to check whether the given number is positive , negative or zero. If…..else if ladder is used to check it.
#include<stdio.h>
#include<conio.h>
void main()
{ int n;
clrscr();
printf(“Enter number:”);
scanf(“%d”,&n);
if(n>0)
{ printf(“%d is positive”,n);
}
else if(n<0)
{ printf(“%d is negative”,n);
}
else
{ printf(“number is 0”);
}
getch();
}
Output