Proposed exercise
Write a C# program to calculate and display the average of four numbers entered by the user.
Output
Solution
using System; public class Average { public static void Main() { int average=0; int number; for (int i=0; i < 4; i++) { Console.Write("Enter the number {0}: ", i + 1); number = Convert.ToInt32( Console.ReadLine() ); average += number; } Console.WriteLine("Average is {0}", average / 4); } }