Important C Programs

C Program to Check Whether a Number is Positive or Negative

//C Program to Check Whether a Number is Positive or Negative
//Header Files
#include<stdio.h>
#include<conio.h>

void main()
{

int number;
clrscr();
printf("Enter a number: ");
scanf("%d", &number);

// true if number is less than 0
if (number < 0)
{

printf("You entered a negative number.");

}

// true if number is greater than 0
else if ( number > 0)
{

printf("You entered a positive number.");

}

// if both test expression is evaluated to false
else
{

printf("You entered 0.");

}
getch();

}

Output


You can also see a video how to run this program