Problem 55

Adding Values in a Loop

Write a program that gets several integers from the user.

You must use a while loop.

I will add up the numbers you give me.
Number: 6
The total so far is 6
Number: 9
The total so far is 15
Number: -3
The total so far is 12
Number: 2
The total so far is 14
Number: 0

The total is 14.
I will add up the numbers you give me.
Number: 1
The total so far is 1
Number: 2
The total so far is 3
Number: 3
The total so far is 6
Number: 4
The total so far is 10
Number: 5
The total so far is 15
Number: 0

The total is 15

◄ 54: Hi-Lo with Limited Tries 56: do-while Swimming ►



Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.