Sign in with
Sign up | Sign in
Your question

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

Tags:
  • Apps
Last response: in Apps General Discussion
Share
April 9, 2014 9:05:52 AM

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

More about : program input ten numbers keyboard add numbers

April 9, 2014 9:12:17 AM

Are you looking for code?
(This is in python, but easy to adapt for other languages)
  1. def sum_below_zero():
  2. total = 0
  3. temp_val = 0
  4. for i in range(10):
  5. temp_val = int(input("Input a number: "))
  6. if temp_val < 0:
  7. total += temp_val
  8.  
  9. return total
m
0
l
April 9, 2014 9:20:11 AM

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.
m
0
l
!