LAB 2: Averages
Challenge 1: - Average Numbers:
Write a standalone program that will average the numbers in a list. Start with the following set of numbers 4,6,8,3,5,8,9,9,3,7
Have the output print the following to the console
This AWESOME program will average of the following numbers 4,6,8,3,5,8,9,9,3,7
The SUM is 62 and the Average is 6.2
Before you run off to Google to find code that is already built to do this, please take some time to solve this on your own.
Hint:
- You will need a variable to hold the count of how many numbers are in the list. You will need to loop through and sum up the numbers. and then device by how many numbers there are.
Take a look at Calculator Soup site for an explanation http://www.calculatorsoup.com/calculators/statistics/average.php
Challenge 2: - Add Mean and Median: You can add to the Mean and Median to your program. In the comments add the definition of Average, Mean, Median
Challenge 3 - Add Input to Your Program:
Add an input statement to your code, such that it will accept an
integer input and loop until you enter "q". You will need to save the input numbers in a list and keep track of how many numbers you enter:
No comments:
Post a Comment