programming-examples/c/Basic/C Program to Check if a given Integer is Positive or Negative.c
2019-11-18 14:44:36 +01:00

16 lines
343 B
C

/*
* C program to check whether a given integer is positive
* or negative
*/
#include <stdio.h>
void main()
{
int number;
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);
}