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

  A number is said to be negative if it is less than zero and it is said to be positive  if it is greater than zero . So in the program we will check that number is greater than zero or not .So let’s start……….

 code:-

#include<stdio.h>
int main()
{
int n;
printf(“Enter a number “);
scanf(“%d”,&n);
if(n>0)
{
printf(“Number is postive”);
}
else if(n==0)
{
printf(“Number is zero”);
}
else
printf(“Number is negative”);
return 0;
}

Output:-

Enter a number
25
Number is negative

Video solution:-




Recommended Post:

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

Key points:-

 MCQs:-


Leave a Reply

Your email address will not be published.