Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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; iRecall 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started