Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

I need help with this C++ code.?

Assignment #1

Print a M by N multiplication table as following. Headers must be included in the table. Allow user to enter the size of the table (M by N).

1 2 3 4 5 6 ... N

1 1 2 3 4 5 6 ...

2 2 4 6 8 10...

...

M .................................

1 Answer

Relevance
  • 8 years ago
    Favorite Answer

    Something like this will work. Check first (run the program), might have some errors.

    #include <iostream>

    using namespace std;

    int main(){

    int n, m;

    cout << "Enter number of rows and columns";

    cin >> m >> n;

    for (int i = 0; i< n+1; i++)

    cout << i << " "

    cout << "\n"

    for (int i = 1; i<= m; i++){

    cout << i;

    for (int j = 1; j<= n; i++)

    cout << i*j << " ";

    cout << "\n";

    }

    }

    Source(s): C++ programmer
Still have questions? Get your answers by asking now.