Problem

Extend the function of Exercise 5 so that it also outputs a running total as the numbers a...

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

Step-by-Step Solution

Request Professional Solution

Request Solution!

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.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT