
{filelink=18437}
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
public static class Calcultableau
{
public static decimal moyenne(decimal[] valeurs)
{
if (valeurs == null || valeurs.Length == 0)
throw new ArgumentNullException("valeurs");
decimal acc = 0;
for (int i = 0; i < valeurs.Length; i++)
{
acc += valeurs[i];
}
return acc / valeurs.Length;
}
public static void Main(string []arg)
{
Console.WriteLine("La moyenne du tableau new Decimal{12,16,14,18}: " +moyenne(new Decimal[] { 12, 16, 14, 18 }));
}
}