a certain program input ten numbers via keyboard and add up all the numbers less than zero

a certain program input ten numbers via keyboard and add up all the numbers less than zero
2 answers Last reply
More about program input ten numbers keyboard add numbers
  1. Are you looking for code?
    (This is in python, but easy to adapt for other languages)
    
    def sum_below_zero():
        total = 0
        temp_val = 0
        for i in range(10):
            temp_val = int(input("Input a number: "))
            if temp_val < 0:
                total += temp_val
         
        return total
    
  2. We tend to frown on people asking homework questions here. You're meant to be learning something, and handing you the solution on a platter is effectively cheating.

    Paste some code you've tried. Explain what language you're using.
Ask a new question

Read More

Apps