100 746
Assignments Done
98.1%
Successfully Done
In July 2021

# Answer to Question #12112 in C# for Nicole

Question #12112
A program to read in a list of test scores and output the highest score,the lowest score, and the average score.
1
2012-07-20T11:25:19-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TEMP
{
class Program
{
& static void Main(string[] args)
& {
int n = 0;
List<int> scores = new List<int>();
Console.Write("Enter number of scores: ");
Console.WriteLine("Enter " + n.ToString() + " scores");
for (int i = 0; i < n; i++)
{
Console.Write((i + 1).ToString() + ". ");
}

int min = int.MaxValue;
int max = int.MinValue;
int sum = 0;
double average;

foreach (int t in scores)
{
if (t > max)
& max = t;
if (t < min)
& min = t;
sum += t;
}
average = sum / n;
Console.WriteLine(" The higest score: " + max.ToString());
Console.WriteLine(" The lowest score: " + min.ToString());
Console.WriteLine("The average score: " + average.ToString());
& }
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!