Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1.         static void PrintArray(int[,] array)
  2.         {
  3.             int row = array.GetLength(0);
  4.             int col = array.GetLength(1);
  5.             double max = Math.Floor(Math.Log10(array.Cast<int>().Max())) + 1;
  6.  
  7.             for (int r = 0; r < row; r++)
  8.             {
  9.                 for (int c = 0; c < col; c++)
  10.                 {
  11.                     for (int ws = 1; ws <= ( max - Math.Floor( Math.Log10(array[r, c] ))); ws++)
  12.                     {
  13.                         Console.Write(" ");
  14.                     }
  15.                     Console.Write(array[r, c]);
  16.                 }
  17.                 Console.WriteLine("");
  18.             }
  19.             Console.WriteLine("");
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement