Programming Examples

Python program to check number is positive negative or zero


write a program to print one of the words negative, zero or positive, according to whether variable x is less than zero, zero, or greater than zero, respectively.

Solution

x=int(input("Enter any Integer Number : "))
if x==0:
    print("Number is Zero")
elif x>0:
    print("It is Positive Number")
else:
    print("It is Negative Number")
Output

Enter any Integer Number : 4

It is Positive Number

>>> 

======================== R

Enter any Integer Number : -9

It is Negative Number

>>> 

======================== 

Enter any Integer Number : 0

Number is Zero

CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad