C Program to Check the Number is Positive or Negative

Check the Number is Positive, Negative in C language

Here's the program to check whether the number is positive or negative.

In this program, we are taking the value at runtime by the user to check whether it is negative or positive using if else condition.

Code to Check Number is Positive or Negative

#include<stdio.h>

void main()
{

int num;

printf("Enter Any Number");

scanf("%i", &num);

if(num > 1)
{
printf("The number is positive");
}

else if(num < 0)
{
printf("The number is negative");
}

else
{
printf("Invalid Input!");
}

}

Comments

Popular posts from this blog

Pseudocode to Check, Number is Odd or Even

How to Create Marksheet in C