Two dimmensional array feeding : need to do an arr[n,n] which will do a result as [0,0] = 0 [0,1] = 1 [0,2] = 3 [0,3] = 6 [1,1] = 0 [1,2] = 2 [1,3] = 5 [2,2] = 0 [2,3] = 3 [3,3] = 0

It is night right now and I feel so flustrated(read sleepy) as I can't solve the problem. Trying to feed that arr with two for cycles, that's I think is good way to go. Anyway, can't figure out how to set conditions to generate it as I want it.

Any hint is welcome, trying to programme solution for optional task in school.
Pasting code which I ended, totaly mishmash. I guess when I wake up in the morning I will try to do it once again all. Thanks for any hint/advice.


I tried to feed an array with two fors, where I tried to sum values. So many errors occur when I start typing code. 

```int[,] array_prava = new int[n, 


            for (int i = 0; i < n; i++) // array_prava
            {
                for (int j = 0; j < n; j++)
                {
                    if (j == i || j == 0)
                    {
                        array_prava[i, j] = Math.Abs(j - i);
                       }
                    else if (i >= 1)
                    {
                        array_prava[i, j] = Math.Abs(j + 1 - i) + array_prava[i, j - 1];
                           }
                    else if (i > j) {
                        array_prava[i, j] = 0;
                    }else
                    {
                        array_prava[i, j] = Math.Abs(j - i) + array_prava[i, j - 1];
                        
                    }

any hint is welcome