Make a C++ program that will print the multiplication table using nested loop.
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
cout << " ";
for (int i=1; i<10; i++)
cout << setw(2) << i << " ";
cout << endl;
cout << " ";
for (int i=1; i<10; i++)
cout << "---";
cout << endl;
for (int i=1; i<10; i++) {
cout << i << ": ";
for (int j=1; j<10; j++)
cout << setw(2) << i*j << " ";
cout << endl;
}
}
Comments
Leave a comment