Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that computes the average of five exam scores. Declare and perfo

ID: 3658923 • Letter: W

Question

Write a program that computes the average of five exam scores. Declare and perform a compile-time initialization with five values. Use a constant to define the number of scores. Print all scores and the average value formatted with no digits to the right of the decimal.

Explanation / Answer

using System; public class average { public static void Main(string[] args) { double input = 0, average = 0; int numberOfTerms = 1; Console.WriteLine("To end this program, enter a negative number and press any key."); while (input >= 0) { Console.Write("Enter a number in your sequence: "); input = Double.Parse(Console.ReadLine()); if (input > 0) { average = input / numberOfTerms; } numberOfTerms = numberOfTerms + 1; Console.WriteLine("The average so far is {0}.", average); } Console.ReadKey(true); } } You can compile c# using the command line version C:>csc average.cs

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote