The ones who are crazy enough to think they can change the world are the ones who do.
- Steve Jobs

C Positive or Negative Number

C Positive or Negative

C Program - Positive or Negative Number

Let us write a C program to find whether user entered number is positive or negative.

positive-negative.c
#include <stdio.h>
int main()
{
int num;
printf("\n Enter the integer number : ");
scanf("%d",&num);
if(num >= 0)
{
printf("\n%d is a positive number", num);
}
else
{
printf("\n%d is a negative number", num);
}
return 0;
}
Enter the integer number : - 4
- 4 is a negative number

Note:

Here we used if conditional statement to find whether the number is positive or negative.

Report Us

We may make mistakes(spelling, program bug, typing mistake and etc.), So we have this container to collect mistakes. We highly respect your findings.

Report