Python Program to Check Whether a Number is Even or                                                 Odd

Check if a Number is Positive or Negative in Python

Given an integer input, The objective is to write a code to Check if a Number is Positive or Negative in Python Language.

For Instance,Input : Num = -5
Output : The number is Negative

Flow Diagram:-

flowchart-in-c21.png

Code:-

  • For a user input num

  • If the num > 0: it is a positive number.

  • If the num < 0: it is a positive number.

  • Else the number has to be zero itself

Algorithm:-

Code:-

num = int(input("Enter a number")

if num == 0:

   print("Number is Zero")

elif num > 0:

   print("Number is Positive")

else:

   print("Number is Negative")

Output:-

Enter a number: 22

The number is Positive