Question: using System; class MainClass { public static double avg(int[] arr) { double sum = 0; for(int i=0; i

using System; class MainClass { public static double avg(int[] arr) { double sum = 0; for(int i=0; i 

Recall Average Test Scores for loop that averages test scores.

  • Declare an array of size 4 (use a constant for loop SIZE)
  • Use a for loop to accept user input for the test scores
    • Add input validation to only accept numbers between 1 and 100 (Reach out on the discussion board if you are stumped!)
    • Store the input in the array
    • The loop must only allow the SIZE of the array input . What happens if you go over? Discuss this with classmates on the discussion board this week
  • Write a foreach loop to average the test scores
  • Display the average with 2 decimal points precison.

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!