Q:

How to make a multidimensional array using while loop in C#

I'm a beginner in c# and I have to write a multidimensional array using while loop. I just can't go through it. So far I have made what I exactly need with nested for loop but can't convert it to while loop. Any help would be greatly appreciated.
int[][] tab = new int[4][];
tab[0] = new int[4];
tab[1] = new int[3];
tab[2] = new int[2];
tab[3] = new int[1];

int num = 1;

for(int i = 0; i < tab.Length; i++)
{
    for(int j = 0; j < tab[i].Length; j++)
    {
        tab[i][j] = num++;
    }
}

for(int i = 0; i < tab.Length; i++)
{
    Console.Write("tab[{0}] = ", i);
    for(int j = 0; j < tab[i].Length; j++)
    {
        Console.Write("{0} ", tab[i][j]);
    }
    Console.WriteLine(""); 
}

A:

A for loop is a dressed up while loop, you're already very close. 
consider that   
for(a; b; c) { ...; }

is equal to (without the break/continue labels for brevity)
 { a; while (b) { ...; c; } }

You should be able to do this conversion easily. But I think a teacher should also just accept code with a for loop as it is functionally a while loop. 
Now there could be other constraints in your homework, like allowing nested loops or the  [,] or [][] style multi dimensional arrays (again, functionally the same, different C# notations for slightly different feature sets).

A:

Updated answer to remove redundant console write line loop
while (ai < tab.Length)
{
    bj = 0;
    Console.Write("tab[{0}] = ", ai);
    while (bj < tab[ai].Length)
    {
        tab[ai][bj] = num++;
        Console.Write("{0} ", tab[ai][bj]);
        bj++;
    }
    Console.WriteLine("");
    ai++;
}

