Sum of a RANGE of numbers.

Land Rover MENA CC licensed photo by Land Rover Ride & Drive Desert Event | Alfardan Premier Motors Qatar on Flickr
Land Rover MENA CC licensed photo by Land Rover Ride & Drive Desert Event | Alfardan Premier Motors Qatar on Flickr

This WSQ was a little bit more difficult, than the ones before. I got inspiration from a friend’s code but I didn’t liked so I change some parts of his code.

First I would like you to see my code. I tried used a function and a condition while to make the program sum all the integers between the two given numbers. I confess there is a problem when the user types consecutive numbers but I don’t know how to fix it. (Also when using negative numbers…)

Nevertheless I feel proud of my “adding machine”! First this, and later I will conquer the world with my software development abilities!

Code:

07 Rover

I used this web page to figure out how to order the numbers:

http://codereview.stackexchange.com/questions/64758/sort-three-input-values-by-order

I also recommend this web page to understand the functions:

http://www.cplusplus.com/doc/tutorial/functions/

This time no one helped me (besides reading Eduardo’s  code).

 

P.S.: I promise to use GitHub next partial, and I will update my posts with a GitHub link. Thank you for your patience.

 

CC BY 4.0 WSQ07 by Octavio Rojas is licensed under a Creative Commons Attribution 4.0 International License.