Write a C# program to find the average of a sequence of nonnegative numbers entered by the user, where the user enters a negative number to terminate the input.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
int[] ipse = new int[5];
double av, t = 0;
for (int i = 0; i <= 4; i++)
{
Console.WriteLine("Enter The No {0} Element in Series", i + 1);
ipse[i] = Int32.Parse(Console.ReadLine());
if (ipse[i] < 0)
Environment.Exit(0);

t = (t + ipse[i]);
}
av = t / 5;
Console.WriteLine("Average = " + av);




Console.ReadKey();

}


}
}



www.ittaleem.com