/******************************************************/ /* Introduction to Programming */ /* By Dr. ANTF */ /* www.antf.net */ /* Copyright 2015 */ /* */ /* C# 305 - Problem 4: Class Average (a) */ /******************************************************/ 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 numberOfStudents, studentAverage, sum = 0; Console.Write("Please enter the number of students: "); numberOfStudents = int.Parse(Console.ReadLine()); Console.WriteLine("\n"); for (int i = 0; i < numberOfStudents; i++) { Console.Write("Enter the average of Student number {0}: ", i + 1); studentAverage = int.Parse(Console.ReadLine()); sum = sum + studentAverage; } Console.WriteLine("\n\nThe class average is: {0}", sum / numberOfStudents); Console.ReadKey(); } } }