115k views
1 vote
Write a program that will add up the series of numbers: 105, 104, 103… 3, 2, 1. The program should print the running total as well as the total at the end. The program should use one for loop, the range() function, and one print() command.

Sample Run
105
209
312
414
515
615



5555
5559
5562
5564
5565

User Colemars
by
7.4k points

1 Answer

0 votes

Anwer=5565

sum = 0

for i in range(105,0,-1):

sum = sum + i

print(sum)

The sum value initializes at 0. The loop starts with 105, ends with 1, and decreases the value by 1. The numbers add to each iteration's sum until the loop ends and displays the sum.

User Quesofat
by
7.8k points