Can,t solve this help plz? RRS feed

  • Question

  • To repeatedly prompt for a number and sum it. When the sum just exceeds 100, stop the prompting and display the sum at the end. You must not display the sum while the user in typing in numbers. (You do not need a counter but you will need some way of terminating the loop). Using the for loop only.
    Monday, February 20, 2017 6:11 PM

All replies

  • Do not ask people to do your homework here.

    That said, here is the hint:

    The for statement has three parts - Initializer that is executed only once when the loop starts, condition that run once on each loop, and will exit the loop when evaluated to false, and iterator that signal the logic to proceed to the next item. When there is no need for iterator, it could be empty.

    • Edited by cheong00Editor Tuesday, February 21, 2017 1:27 AM
    • Proposed as answer by Kristin Xie Friday, February 24, 2017 2:00 AM
    Tuesday, February 21, 2017 1:27 AM