Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

INSTRUCTIONS Write a program that displays a 2D multiplication table based on ro

ID: 440167 • Letter: I

Question

INSTRUCTIONS

Write a program that displays a 2D multiplication table based on row and column values specified by the user.The multiplication table should line up in an aesthetically pleasing manner and mimic the following format:

Please enter the number of columns: 8

Please enter the number of rows: 6

|1|2|3|4|5|6|7|8|

+---+---+---+---+---+---+---+---+

1|1|2|3|4|5|6|7|8|

2|2|4|6|8| 10| 12| 14| 16|

3|3|6|9| 12| 15| 18| 21| 24|

4|4|8| 12| 16| 20| 24| 28| 32|

5|5| 10| 15| 20| 25| 30| 35| 40|

6|6| 12| 18| 24| 30| 36| 42| 48|

Press any key to continue

Explanation / Answer

#include <iostream>

#include <iomanip>
using namespace std;
int numbers[10][1] = {1,2,3,4,5,6,7,8,9,10};

main() {
cout <<setw(31) << " MULTIPLICATION TABLE ";

cout << " ";

for (int row1=0; row1 < 10; row1++ )

{

for (int col1=0; col1 < 1; col1++ )

{

cout << " ";

for (int row2=0; row2 < 10; row2++ )

{

for (int col2=0; col2 < 1; col2++ )

{

cout << setw(4) <<numbers[row2][col2] * numbers[row1][col1];

} } // Two Inner Loop } // Two Outter Loop }

cout << " ";

system("PAUSE");

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote