40 likes | 124 Vues
LAB SESSION. ONE DIMENSIONAL ARRAY. Question 1 (edited FROM csc 128 march 2012 exam paper).
E N D
LAB SESSION ONE DIMENSIONAL ARRAY
Question 1(edited FROM csc 128 march 2012 exam paper) • Compass is currently holding a charity car wash for a week. You are asked to write a program that calculates and displays the total collection, the average collection, and the minimum and maximum collection for the week. • Thus, create an array of floating point of size SEVEN (7) to store the total collection per day from Monday through Sunday. • Sample input and output as below:
Question 3(taken FROM csc 128 sept 2011 exam paper) • Write a program that accepts any number of integers from the user in the range of 1 • to 50 only. Only numbers in the range 1 to 50 should be stored in an array. The • maximum size of the array is 100. Calculate the sum of the integers in the array and • display the result. Assume the input ends when -1 is encountered.