Skip to content

Instantly share code, notes, and snippets.

@aeristhy
Created December 6, 2021 02:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aeristhy/0fa0050b75de8e6d3105c21ef8aae138 to your computer and use it in GitHub Desktop.
Save aeristhy/0fa0050b75de8e6d3105c21ef8aae138 to your computer and use it in GitHub Desktop.
Using multidimensional arrays that creates a program that will display the multiplication table up to 49 only. (Array Exercises #4)
#include <iostream>
using namespace std;
int main()
{
constexpr int rows{ 8 };
constexpr int cols{ 8 };
int product[rows][cols]{};
for (int row{ 1 }; row < rows; ++row) {
for (int col{ 1 }; col < cols; ++col) {
product[row][col] = row * col;
}
}
for (int row{ 1 }; row < rows; ++row) {
for (int col{ 1 }; col < cols; ++col) {
cout << product[row][col] << '\t';
}
cout << '\n';
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment