using System; public class Moyenne { public static void Main() { int x = 0, n = 0, sum = 0; int[] tab = new int[100]; try { string st = Console.ReadLine(); x = int.Parse(st); while( x >= 0 ) { tab[n] = x; n++; st = Console.ReadLine(); x = int.Parse(st); } int length = n; for(int i = 0; i < length; i++) { sum += tab[i]; } float moy = (float)sum / length; Console.Out.WriteLine("{0:N2}",moy); } catch (Exception e) { Console.Out.WriteLine("Entrée invalide !"); } } // main() } // class Moyenne