C Program to Check Whether a Number is Negative or Positive


C Program Code:


#include<stdio.h> 
#include<conio.h>
void main()
{
    int num;
    printf("Enter the Number: ");
    scanf("%d", num);
    if (num <= 0) {
        if (num == 0) {
            printf(Entered Number 0.");
        }
        else {
            printf(Entered Number is Negative.");
        }
    } 
    else {
        printf(Entered Number is Positive.");
    }
    getch();
}
        

Output:


Post a Comment

0 Comments