Home » Software » Language » C Programming » C program to check whether a given integer number is positive or negative

C program to check whether a given integer number is positive or negative



/* Write a C program to check whether a given integer number is positive or 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
Enter a number
-5
-5, is a negative number

RUN2
Enter a number
89
89, is a positive number
——————————*/

Print Friendly

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Current ye@r *

Scroll To Top