Advertisement
LePetitGlacon

FICHE 6.5 : Exercice 2

Nov 25th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2.  
  3. namespace o
  4. {
  5.     class Program
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             int[,] monTab2D = { { 1, 3, 5, 7 }, { 2, 4, 6, 8 }, { 3, 6, 9, 12 } };
  10.             int compteur = 0;
  11.             float total=0;
  12.             for(int iLig = 0; iLig <3 ; iLig ++)
  13.             {
  14.                 for(int iCol = 0; iCol <4 ; iCol ++, compteur++)
  15.                 {
  16.                     total = total + monTab2D[iLig,iCol];
  17.                 }
  18.             }
  19.             float somme = total / compteur;
  20.             Console.WriteLine("La moyenne des notes du tableau est {0}",somme);
  21.              Console.ReadKey();
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement