class TestParams
{
private static void Average(string title, params int[] values)
{
int sum = 0;
for (int i = 0; i < values.Length; i++)
{
sum += values[i];
System.Console.Write(values[i] + ", ");
}
System.Console.WriteLine((float)sum/values.Length);
}
static void Main()
{
Average ("List One", 5, 10, 15);
Average ("List Two", 5, 10, 15, 20, 25, 30);
}
}
|