made general method for printing a matrix and a method to find the table size