Sum of numbers! #WSQ07

This programs ask you for two different integer numbers, then it will sum the integer numbers between this two numbers and both numbers. For example, if you chose 1 and 6, it wills sum 2, 3, 4, 5 and both numbers, 1 and 6, giving a total of 21. To write the code, I had to use the function while. You can also use do-while or for, these three functions works for the program, though each one of them have advantages over the others. I also use this simbols after a variable: ++. Their function is to increase for one the variable every time the loop repeats.

Here is the code:

Here is the code executed

CC BY 4.0 Sum of numbers! #WSQ07 by Alan Valdovinos is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.