Write a C program that reads a single integer number from the keyboard via the scanf function, determines if the number is either, positive, zero, or negative and then prints out a message such as: "The number is positive." or "The number is zero." or "The number is negative.
Here is the solution for the above question:
#include <stdio.h>
int main(int argc, char *argv[])
{
int num;
printf("Please enter a number: ");
scanf("%d",&num);
if(num == 0)
{
printf("The number is zero.\n");
}
else if(num > 0)
{
printf("The number is positive.\n");
}
else if(num < 0)
{
printf("The number is negative.\n");
}
return 0;
}