SHARE
TWEET

Untitled

a guest Sep 17th, 2015 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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())) + 2;
  6.             string format = "{0," + max +"}";
  7.  
  8.             Console.WriteLine(format);
  9.             for (int r = 0; r < row; r++)
  10.             {
  11.                 for (int c = 0; c < col; c++)
  12.                 {
  13.                     Console.Write(format, array[r, c]);
  14.                 }
  15.                 Console.WriteLine("");
  16.             }
  17.             Console.WriteLine("");
  18.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top