How to check number is positive, negative or zero?
CODE
How to check number
is positive, negative or zero?
int main()
{
int a;
printf("\n enter number:");
scanf("%f",&a);
if(a<0)
printf("\n number is negative.");
else
if(a>0)
printf("\n number is positive");
else
printf("\n number is zero");
}
Output:
enter number:
5
number is positive
OR
enter number:
0
number is zero
OR
enter number:
-45
number is negative.
How to check number is positive, negative or zero?
Reviewed by Unknown
on
December 15, 2018
Rating:
No comments:
If you have any doubt or query ,comment below: