number positive or negative in c programming code example
Example: c program for positive or negative
//Negative or positive
#include <stdio.h>
int main()
{
int Num;
printf("Test Data: ");
scanf("%d", &Num);
//A negative number is less than 0, so the if suggests that if the program detects any number less than 0, then it must be a negative
if(Num < 0)
{
printf("%d is a Negative number", Num);
}
//Otherwise, the program will consider the number as positive.
else
{
printf("%d is a Positive number", Num);
}
}