#include #define ROWSIZE 9 #define COLSIZE 9 /* print the multiplication table */ int printTbl(int tbl[][COLSIZE], int rowSize, int colSize); int main( void ) { int row, col; int table[ROWSIZE][COLSIZE]; /* keep the table in a 2-D array */ /* Using nested for loops to compute the table */ for (row = 0; row < ROWSIZE; row ++) for (col = 0; col < COLSIZE; col ++) { table[row][col] = (row+1) * (col+1); } printTbl(table, ROWSIZE, COLSIZE); return 0; } int printTbl(int tbl[][COLSIZE], int rowSize, int colSize) /* specifying the number of columns of the table; passing the size of the table - rowSize x colSize */ { int i, j; printf("*"); for (j = 1; j <= colSize; j ++) { printf("%4d", j); } printf("\n"); for (i = 0; i < rowSize; i ++) { printf("%d", i+1); for (j = 0; j < colSize; j++) { printf("%4d", tbl[i][j]); } printf("\n"); } return 0; }