Home >>c programs >c program to check positive or negative
If the input number is greater than 0, then the given number is positive, else it is a negative number. If the number is equal to 0, then the given number is equal to zero.
Let's take an example :
#include <stdio.h> int main() { int num=11; if(num>=0) { printf("Given Number is Positive number"); } else { printf("Given Number is negative Number"); } }
#include<stdio.h> int main() { int num=0; printf("Please enter Your number:"); scanf("%d",&num); if(num>=0) { printf("Given Number is Positive num"); } else { printf("Given Number is negative num"); } return 0; }