Question: 6.6 LAB: Sum without smallest list function Write a program the reads five integers and adds them to a list and then passes the list
6.6 LAB: Sum without smallest list function 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 tot al 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. - retirn the total minus smallest value from the funation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
