24/12/2016

C Program To Check Number Is Positive Or Negative

Problem :- Write A C Program To Check Number Is Positive Or Negative .Number should be Entered Through User Then program Print the Output .

Logic :- As we know that if number is greater than 0 ( Zero ) Than number is positive and if number is Less than 0 ( Zero ) than number is Negative and else number is equal to zero than entered number is Zero .

See Also :- C++ Program To Check Number Is Positive Or Negative

Solution :- 

#include<stdio.h>
int main()
{
int a;
printf("Enter The Number You Want To Check :\n");
scanf("%d",&a);

if(a<0)
{
printf("Number Is Negative:\n");
}
else if(a>0)
{
printf("Number Is Possitive:\n");
}
else
{
printf("You Enter Zero :\n");
  }
return 0;

}

See Also :- Java Program To Check Number Is Positive Or Negative

Output:-

C Program To Check Number Is Positive Or Negative

Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

1 comment:

  1. where ARE THE examples on positive negitive or neutrality

    ReplyDelete