Check positive, negative or zero number C program

It’s a positive, negative or zero number C program that inputs any number from the user, then check its a positive number, negative number or zero and print result on the screen.

To understand this program, it’s better you should know the following topics:

Program (1): to check the number is positive, negative or zero.

#include<stdio.h>
#include<conio.h>
void main(void)
{
   int num;
   printf("Enter a Number : ");
   scanf("%d",&num);
if (num>0)
printf("Number is positive");
else if (num<0)
  printf("Number is negative");
    else
        printf("Number is zero");
getch();
}

Output (1)

Enter a Number : -2
Number is negative

Published by

Electrical Workbook

We provide tutoring in Electrical Engineering.

Leave a Reply

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