Write a program to check whether a number is positive, negative or zero

A number is said to be positive if it is greater than zero and negative if less than zero.

#include<stdio.h>
void main()
{
  int n;
  printf("Enter a number: ");
  scanf("%d",&n);
  
  if(n==0)
  printf("The number is Zero");
 
  else if(n>0)
  printf("The number is a positive number");

  else
  printf("The number is a negative number");

}

Post a Comment

0 Comments