Extend the function of Exercise 5 so that it also outputs a running total as the numbers are printed out in reverse order. For example, the T/O dialog might be the following:
Enter positive number, 0 to end: 10Total: 10Enter positive number, 0 to end: 20Total: 30Enter positive number, 0 to end: 30Total: 60Enter positive number, 0 to end: 0
The function then outputs
30 Total: 3020 Total: 5010 Total: 60
Exercise 5
Extend the function of Exercise 4 so that it also outputs a running total of the numbers as they are entered. For example, the I/O dialog might be the following:
Enter positive number, 0 to end: 10Total: 10Enter positive number, 0 to end: 20Total: 30Enter positive number, 0 to end: 30Total: 60Enter positive number, 0 to end: 0
The function then outputs
30
20
10
Exercise 4
Write a recursive function that asks the user to enter a positive integer number each time it is called, until zero or a negative number is input. The function then outputs the numbers entered in reverse order. For example, the I/O dialog might be the following:
Enter positive number, 0 to end: 10Enter positive number, 0 to end: 20Enter positive number, 0 to end: 30Enter positive number, 0 to end: 0
The function then outputs
30
20
10
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.