Computer Science
Write a program to check if the number is positive or negative and display an appropriate message.
Python
Python Control Flow
1 Like
Answer
number = int(input("Enter a number: "))
if number > 0:
print("The number is positive.")
else:
print("The number is negative.")
Output
Enter a number: 4
The number is positive.
Enter a number: -6
The number is negative.
Answered By
2 Likes
Related Questions
Find the output of the following program segment:
country = 'INDIA' for i in country: print (i)
Find the output of the following program segment:
i = 0; sum = 0 while i < 9: if i % 4 == 0: sum = sum + i i = i + 2 print (sum)
WAP to display even numbers between 10 and 20.
WAP to perform all the mathematical operations of a calculator.