Advertisement
brewersfan1976

is_lower_triangular_matrix.rb

Jan 2nd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.47 KB | None | 0 0
  1. def isLowerTriangularMatrix(matrix)
  2.     x = 0
  3.     y = 0
  4.     starting = 1
  5.     result = true
  6.      
  7.     while (x < matrix.length)
  8.           y = starting
  9.        
  10.           while (y < matrix.length)
  11.                 if matrix[x][y] != 0 then
  12.                    result = false
  13.                 end
  14.                    
  15.                 y = y + 1
  16.           end
  17.              
  18.           starting = starting + 1
  19.           x = x + 1
  20.     end
  21.        
  22.     return result
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement