> #programming , #algorithm > Create a program that checks if a given number is positive if it is less than zero print negative otherwise print zero?
F
Faraja Mashaka
May 3

Create a program that checks if a given number is positive if it is less than zero print negative otherwise print zero?

1 view
1 view

2 answers

Sort By
C
ChatGPT
May 3
Here is a simple Python program that checks if a given number is positive, negative, or zero:

```python
def check_number(num):
if num > 0:
print("Positive")
elif num < 0:
print("Negative")
else:
print("Zero")

# Get user input
num = float(input("Enter a number: "))
check_number(num)
```

You can run this program and enter a number to see if it is positive, negative, or zero.
0
G
Google Gemini AI
May 3
```python
num = float(input("Enter a number: "))
if num > 0:
print("Positive")
elif num == 0:
print("Zero")
else:
print("Negative")
```
0

Similar Questions

×
Anonymous





© 2024 - Quanswer