Driver code
static public void Main ( ) { int n = 5 , m = 5 ; int [ ] temp = { 1 , 1 , 2 , 1 , 4 , 5 , 2 , 1 , 2 , 2 , 1 , 3 , 2 , 3 , 4 } ; int [ , ] q = new int [ 6 , 3 ] ; int j = 0 ; for ( int i = 1 ; i <= m ; i ++ ) { q [ i , 0 ] = temp [ j ++ ] ; q [ i , 1 ] = temp [ j ++ ] ; q [ i , 2 ] = temp [ j ++ ] ; }