Write a program to find no. Is +ve or -ve in python
Answers
Answered by
1
Heya friend,
Here is it :
Let's see on some very very basic concept :
A number greater than 0 is treated as (+)ve
A number less than 0 is treated as (-)ve
Now,
Let's see the code:
SOURCE CODE
#to check whether a number is positive or negative
n=float(input('Enter any number to check :'))
if n>0:
print('The number is positive')
elif n<0:
print('The number is negative')
else:
print('The number is zero itself')
OUTPUT
Enter any number to check :6
The number is positive
>>>
Enter any number to check : -6
The number is negative
>>>
Enter any number to check :0
The number is zero itself
>>>
Thanks !
#BAL #answerwithquality
Similar questions