python program to check if a number is positive ,negative or zero|




python program to check if a number is positive ,negative or zero|



Python program to check if a Number is Positive, Negative or Zero using





We can use a Python program to Check that if a number is positive i.e. 1, 2, 3, 4 etc., negative   i.e. -1, -2, -3, -4 etc.  or zero


python program to check if a number is positive ,negative or zero|
python program to check if a number is positive ,negative or zero





Program-



num = float(input("Enter a number: "))  
  
if num > 0:  

 print("{0} is a positive number".format(num)) 

elif num == 0:  

   print("{0} is zero".format(num))  

else:  
   print("{0} is negative number".format(num))  




Output-


case 1
Enter a number: 6
6.0 is a positive number

case 2
Enter a number: 0
0.0 is zero

case 3
Enter a number: -6
-6.0 is negative number















Post a Comment

Post a Comment (0)

Previous Post Next Post