Multiplication Table


// Takes n, and outputs nxn multiplication table 
#include <iostream>
using namespace std;

int main() 
{
   int n; // The number of rows and columns in the table
   cout << "Please enter the table size: ";
   cin >> n;

   // Print a size x size multiplication table
   for( int row = 1; row <= n; row++ )
   {
      for(int col = 1; col <=n ; col++)
      {
         // Compute product
         int product = row*col;
         
         // formatting: output product using 3 spaces
         if (product < 100)
            cout << ' ';
         if (product < 10 )
            cout << ' ';
         cout << product << ' ';
      }
      cout << endl;
   }

   return 0;
}