First rotation with respect to Secondary diagonal
for ( int i = 0 ; i < N ; i ++ ) { for ( int j = 0 ; j < N - i ; j ++ ) { int temp = arr [ i ] [ j ] ; arr [ i ] [ j ] = arr [ N - 1 - j ] [ N - 1 - i ] ; arr [ N - 1 - j ] [ N - 1 - i ] = temp ; } }