Problem 74
Adding Values with a For Loop
Write a program that gets an integer from the user.
Add up all the numbers from 1
to that number, and display the total. Use a for
loop to do it.
You have done something like this before.
Number: 5 1 2 3 4 5 The sum is 15.
Number: 8 1 2 3 4 5 6 7 8 The sum is 36.
◄ 73: For Loop Challenge 75: Baby Blackjack ►
Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.