1、1平均值using System;using System.Collections;using System.Collections.Generic;using System.Text;namespace ConsoleApplication1class Programstatic protected ArrayList arrList = new ArrayList();static void Main(string args)System.Console.Write(“请输入要求平均值数值的个数:“);int count = int.Parse(System.Console.ReadLin
2、e();for (int i = 0; i count; i+)string strNumber = System.Console.ReadLine();arrList.Add(strNumber);ShowAverage();protected static void ShowAverage()double sum = 0;int count = 0;IEnumerator enumerator = arrList.GetEnumerator();while (enumerator.MoveNext()string strTemp = enumerator.Current.ToString();double dbTemp = double.Parse(strTemp);sum += dbTemp;count+;double average = sum / count;System.Console.WriteLine(“以上数据的平均值为:0“, average);