Question: Write a program the reads five integers and adds them to a list and then passes the list to a function sumWithoutSmallest that computes the

 Write a program the reads five integers and adds them to

Write a program the reads five integers and adds them to a list and then passes the list to a function sumWithoutSmallest that computes the sum of a list of values, except for the smallest one, in a single loop. The main () function has been included for you. All you need to write is the sumWithoutsmallest function that returns the sum. (see p. 268 for an example). Ex: If the list is: [3,7,6,10,19] the returned sum would be 39 and the output is: The sum without the smallest is 39 Instructions: 1. Declare a constant initialized to five (size of list) 2. Write the function sumWithoutsmallest that takes a list as an argument (see p. 268) - create variables for smallest and total and initialize each (see p. 260) - use a for loop and if statement to test each value against smallest (see p. 260) and either declare this value as smallest or add it to your total if it's not the smallest. - return the total minus smallest value from the function The main() method has been called for you

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!