Loop to print the matrix
for ( int i = 0 ; i < M ; i ++ ) { for ( int j = 0 ; j < N ; j ++ ) Console . Write ( a [ i , j ] + " ▁ " ) ; Console . WriteLine ( ) ; } } static void swap ( int [ , ] a , int i , int i2 , int pos , int pos2 ) { int temp = a [ i , i2 ] ; a [ i , i2 ] = a [ pos , pos2 ] ; a [ pos , pos2 ] = temp ; }