23. C Program To Check A Number Is Positive Or Negative.
How does this program work?
- In this program you are going to learn about How to check a number is positive integer or negative integer by using C language.
- Here we using if case to compare the given number with zero if the number is greater then zero then it print result as positive number else it show result as negative number.
- in this concept you will learn about how to use if case in C Language .
Here is the code
#include <stdio.h>
int main(void)
{
int number;
printf ("Enter a number \n");
scanf("%d", &number);
if (number >= 0)
printf("%d is a positive number \n", number);
else
printf("%d is a negative number \n", number);
return 0;
}