Python Program to check if a Number Is Positive Or Negative

Find whether a given number is Positive or Negative

In this Python Program, We will discuss how to find a user entered number is positive or negative. We will check by using a if – else block and compare the given number with zero. If user entered number greater than zero then the number is positive. Else, the number is negative.

Check whhether a number is positive or negative

Algorithm:

Step 1. Start

Step 2. Insert the number.

Step 3. If the number is Zero then print “The number is Zero”

Step4: If the number is greater than zero, then print, “The number is Positive”

Step 5. Else print, “The number is Negative”

Step 6. Stop

Python Program:

n=int(input("Enter a number: "))
if n==0:
print("The number is Zero")
elif n>0:
print("The number is Positive")
else:
print("The number is Negative")

Output:

Enter a number: 23
The number is Positive

One comment on “Python Program to check if a Number Is Positive Or Negative”


  • lohith

    num = int(input(“Insert a number:”))
    if num > 0:
    print(“The number is Positive”)
    elif(num==0):
    print(“The number is zero”)
    else:
    print(“The number is Negative”)