Loop to add N in the lower half of the matrix such that it contains elements from 1 to 2 * N - 1
for ( int i = 0 ; i < n ; i ++ ) for ( int j = 0 ; j < i ; j ++ ) matrix [ i ] [ j ] = matrix [ j ] [ i ] + n ;