C Program to Check if Given Number is Positive or Negative

C Program to Check if Given Number is Positive or Negative

Write a Program to Check if a Given Number is Positive or Negative

//WAP to check whether the given number is positive or negative

#include<stdio.h>

int main()
{
	int n;

	printf("Enter the number :--> ");
	scanf("%d", &n);

	if(n > 0)
	{
		printf("The given number is positive");
	}
	else
	{
		printf("The given number is negative");
	}

	return 0;
}

Output:

Run 1:
Enter the number :--> 8
The given number is positive


Run 2:
Enter the number :--> -9
The given number is negative