daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace arrayRecursion2D
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int[,] array = new int[,] { { 1, 5, 3 }, { 8, 9, 3 }};
  10.             Recursive(array, 0, 0);
  11.         }
  12.  
  13.         public static void Recursive(int[,] array, int i, int j)
  14.         {
  15.             if (i >= array.GetLength(1))
  16.             {
  17.                 return;
  18.             }
  19.  
  20.             if (j >= array.GetLength(0))
  21.             {
  22.                 Console.WriteLine();
  23.  
  24.                 Recursive(array, i + 1, 0);
  25.                 return;
  26.             }
  27.  
  28.             Console.Write(array[i, j] + ", ");
  29.             Recursive(array, i, j + 1);
  30.         }
  31.     }
  32. }
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