Challenge: Classify Numbers
Swipe to start coding
Write a function that takes a single numeric input and returns a string indicating whether the number is "Positive", "Negative", or "Zero". Use if, else if, and else statements to determine the correct label.
- If the input is greater than zero, return "Positive".
- If the input is less than zero, return "Negative".
- If the input is equal to zero, return "Zero".
Løsning
Tak for dine kommentarer!
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Fantastisk!
Completion rate forbedret til 5.56
Challenge: Classify Numbers
Stryg for at vise menuen
Swipe to start coding
Write a function that takes a single numeric input and returns a string indicating whether the number is "Positive", "Negative", or "Zero". Use if, else if, and else statements to determine the correct label.
- If the input is greater than zero, return "Positive".
- If the input is less than zero, return "Negative".
- If the input is equal to zero, return "Zero".
Løsning
Tak for dine kommentarer!
single