Print Lower Hessenberg matrix of order N | Java implementation of the approach ; Function to print the Lower Hessenberg matrix of order n ; If element is above super - diagonal then print 0 ; Print a random digit for every non - zero element ; Driver code
class GFG { static void LowerHessenbergMatrix ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) { for ( int j = 1 ; j <= n ; j ++ ) { if ( j > i + 1 ) System . out . print ( '0' + " ▁ " ) ; else { System . out . printf ( " % .0f " , Math . random ( ) * 10 ) ; System . out . print ( " ▁ " ) ; } } System . out . println ( "NEW_LINE"); } } public static void main ( String [ ] args ) { int n = 4 ; LowerHessenbergMatrix ( n ) ; } }