c program to check whether the number is negative or positive




Positive number is a number that is greater than zero. positive numbers are written as just numbers example : 2. 4 etc

Negative number is a number that is smaller than zero. negative numbers are written with a minus sign in it. example : -8, -10 etc


C program to find negative or positive number have a very simple logic. We just take the input number from the user and check whether the number is greater than zero, if the number greater than zero it is positive, else print negative.


we are using if else computer syntax to check the number is greater than or less than zero. if it is greater than zero print the number as positive else negative.

===================================================================
#include <stdio.h>
 
#include <conio.h>
 
void main()
 
{
	int number;
 
	clrscr();
 
   	printf("Enter a number\n");
 
	scanf ("%d", &number);
 
	if (number > 0)
 
		printf ("%d, is a positive number\n", number);
 
	else
 
		printf ("%d, is a negative number\n", number);
 
}
==================================================================
OUTPUT of C program-check whether positive or negative
==================================================================
Enter a number
-5
-5, is a negative number

RUN2
Enter a number
89
89, is a positive number