/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 305 - Problem 4: Class Average (c) */ /******************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DOS { class Program { static void Main(string[] args) { int studentAverage, sum = 0, count = 0; char anyMoreStudents = 'y'; while(anyMoreStudents == 'y') { Console.Write("Enter the student average: "); studentAverage = int.Parse(Console.ReadLine()); sum += studentAverage; count++; Console.Write("Any more students (y/n): "); anyMoreStudents = char.Parse(Console.ReadLine()); } Console.WriteLine("\n\nThe class average is: {0}", sum / count); Console.ReadKey(); } } }