Ad Code

Responsive Advertisement

Python Program to check if a Number is Positive, Negative or 0

Positive, Negative or Zero

In this Tutorial we will learn to make a Python Program which check if a number is Positive, Negative or ZeroHere we us if statement and if-else statement.




Let us See first how we make this Program and what is the logic behind it.

See first we write a python code to input a number and then we will check if the Number is greater than 0 then it is Positive and if it is lesser than 0 then it will print Negative or we will print Zero if a number is equal to 0.

How to make this Program?


  • First  write the code to enter the Number.

  • Second, use if statement and put the condition if number is less than zero than.

  • Third , print the number is negative.

  • Fourth , use elif statement and put the condition that if the number is greater than zero.

  • Fifth, print the number is Positive.

  • Sixth, use else statement and print the number is zero.



Check it Now-:


n=int(input("Enter the number -:"))
if (n<0):
   print(n,"is Negative")
elif (n>0):
   print(n,"is Positive")
else:
   print(n, "is Zero")



Code Image-:


Code for Copy paste-:


n=int(input("Enter the number -:"))
if (n<0):
   print(n,"is Negative")
elif (n>0):
   print(n,"is Positive")
else:
   print(n, "is Zero")


::: Comment Below For Query :::


Post a Comment

0 Comments