Write C Program to Find that the Accepted Number is Negative, or Positive or Zero

You Should Know

  • what is if else ladder in c
  • what is printf() and scanf()
  • In this c program ,Take Input from user and return output is Negative or positive or zero
  • If Entered Number is zero then output is zero.
  • If Entered Number above zero then output is positive. 
  • If Entered Number below zero then output is Negative.

Write c program to find Entered number is Negative, Positive or Zero

#include<stdio.h>

int main() {
   int no;

   printf("\n Enter Any Number : ");
   scanf("%d", &no);
   if (no == 0) {
      printf("\n Entered Number is Zero");
   } else if (no > 0) {
      printf("\n Entered Number is Positive");
   } else {
      printf("\n Entered Number is Negative");
   }
   return 0;

}

Output

Enter Any Number : -1
Entered Number is Negative

Leave a Reply

avatar
  Subscribe  
Notify of