LePetitGlacon

FICHE 6.5 : Exercice 1

Nov 25th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.70 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.            
  10.             int[,] monTab2D = { { 1, 3, 5, 7 }, { 2, 4, 6, 8 }, { 3, 6, 9, 12 } };
  11.             int compteur = 0;
  12.             for(int iLig = 0; iLig <3 ; iLig ++)
  13.             {
  14.                 for(int iCol = 0; iCol <4 ; iCol ++, compteur++)
  15.                 {
  16.                     Console.Write(" {0} ", monTab2D[iLig, iCol]);
  17.                    
  18.                     if (compteur == 3){
  19.                         Console.WriteLine();
  20.                         compteur = -1;
  21.                     }
  22.                  }
  23.                
  24.             }
  25.              Console.ReadKey();
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment