Tags

,

At first, I tried to only put add a plus-plus (++) the lowest bound, but I did not result as I expected. Obviously, I had to use a loop, (while), to sum the numbers between the bounds one by one in every loop. The result was this…wsq007

I noticed, that using only a++ made the program to add only the subtraction between the bounds plus 1 to the lowest bound, and that had to happen logically.

The condition in “while” was all right.

I had to change that part of the program, I needed something, an operation, that could add number by number from the lowest bound until get to the highest bound. So I decided to set an integer variable to 0, to then add the value of the lowest bound +1 of every loop until the condition breaks or the actual value of a++ reaches the higher bound…

WSQ07

I found a lot of help in the page 72 of the book “How to think like a computer scientist” by Allen B. Downey.

Here is my code on GitHub: https://github.com/tonygarciavz/A01630861-TC1017.git