C program to check whether an integer is positive or negative
Q:-Write a program to check whether an integer is positive or negative
In this c programming example, you will learn to check whether a number is negative or positive.
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
clrscr();
printf("\n Enter a number::");
scanf("%d", &num);
if (num > 0)
printf("%d is a positive number \n", num);
else if (num < 0)
printf("%d is a negative number \n", num);
else
printf("0 is neither positive nor negative");
getch();
}