Here is an implementation of the timestable function in MATLAB using nested loops:
main.m585 chars25 linesThis function takes a positive integer sizeoftable as input, and generates a times table up to the given size. The first row and first column contain integers from 1 to sizeoftable, and the rest of the table contains products of those integers. It uses nested loops to iterate over the rows and columns of the output table, and computes the product of the corresponding row and column headers. Finally, it displays the resulting times table using the disp function.
gistlibby LogSnag