Function to display a matrix
function display ( mat , row , col ) { for ( i = 0 ; i < row ; i ++ ) { for ( j = 0 ; j < col ; j ++ ) document . write ( " " + mat [ i ] [ j ] ) ; document . write ( ' ' ) ; } }