Q: Write a C Program to use simple if statement to check positive negative or zero
How to check for positive number
A number is positive if it is greater than 0 (zero). Use simple if statement.
if (number > 0)
printf(“Number is positive”);
What is the condition for negative number
Use simple if statement to check whether number is negative. Note that a negative number is less than zero.
if (number < 0)
printf(“Number is negative”);
Similarly use simple if statement to check for zero:
if (number == 0)
printf(“Number is Zero”);
The source code for C program to check a number for positive, negative or zero using simple if statement: