Write the pseudocode for a program that uses a two-dimensional array to compute and display the multiplication table shown below. The user should decide the value of n in the example below its 6: (5 Marks) * 1 2 3 4 5 6Â
1 2 2 3 4 5 6Â
2 2 4 6 8 10 12Â
3 3 6 9 12 15 18Â
4 4 8 12 16 20 24Â
// N - number of rows
// M - number of cols
// table[N + 1][M + 1] - multiplication table
for i in {0, N + 1}
for j in {0, M + 1}
table[i][j] = i * j;
// print header
print "* "
for j in {1, M + 1}
print "${j} "
// print table
for i in {1, N + 1}
print "${i} " // row
for j in {1, M + 1}
print "${table[i][j]} "
print "\n"
Comments
Leave a comment