WSQ04. Did someone said Boot Loops or Froot Loops or just Loops?

Let’s get this started by the instructions posted by Ken:

” Write a program that asks for a range of integers and then prints the sum of the numbers in that range (inclusive).

You can use a formula to calculate this of course but what we want you to do here is practice using a loop to do repetitive work.

For example, the sum from 6 to 10 would be 0 + 6 + 7 + 8 + 9 + 10 ”

Here is the code written on Atom:

Screen Shot 2017-04-02 at 6.56.00 PM

Here is the code running on Terminal:

Screen Shot 2017-04-02 at 6.58.15 PM

I made some tests with different values and here are the results; I even put 10 and 10 to see what the result was…for my surprise it is 10.

 

Leave a comment