Q:

C Program To Check Number Is Positive Or Negative

0

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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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;

}

 

Output:

Enter the Number You Want to Check:

-56

Number Is Negative:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now