C++ Program to print Multiplication Table

Write a C++ Program to Print Multiplication Table with an example. The below shown program prints a multiplication table of 4 and 5 up to 10. We used nested for loop to print this, where the first for loop (for (int i = 4; i < 6; i++)) iterates from 4 to 5, and the second one (for (int j = 1; j <= 10; j++)) from 1 to 10.

#include<iostream>
using namespace std;

int main()
{	
	cout << "\nMultiplication Table for 4 and 5  are\n";
	for (int i = 4; i < 6; i++)
	{
		for (int j = 1; j <= 10; j++)
		{
			cout << i << " * " << j << " = " << i * j <<"\n";
		}
    cout <<"\n ==========\n";
	}		
 	return 0;
}
Multiplication Table 1

C++ Program to print Multiplication Table using While loop

This C++ program allows users to enter any value below 10. Next, it will print the multiplication table from that number to 10.

#include<iostream>
using namespace std;

int main()
{	
	int i, j;
	
	cout << "\nPlease enter the Positive Integer Less than 10 = ";
	cin >> i;
	
	cout << "\nMultiplication Table from " << i << " to " << " 10 are\n";
	while (i <= 10)
	{
		for (j = 1; j <= 10; j++)
		{
			cout << i << " * " << j << " = " << i * j <<"\n";
		}
    cout <<"\n ==========\n";
    i++;
	}		
 	return 0;
}
Please enter the Positive Integer Less than 10 = 9

Multiplication Table from 9 to  10 are
9 * 1 = 9
9 * 2 = 18
9 * 3 = 27
9 * 4 = 36
9 * 5 = 45
9 * 6 = 54
9 * 7 = 63
9 * 8 = 72
9 * 9 = 81
9 * 10 = 90

 ==========
10 * 1 = 10
10 * 2 = 20
10 * 3 = 30
10 * 4 = 40
10 * 5 = 50
10 * 6 = 60
10 * 7 = 70
10 * 8 = 80
10 * 9 = 90
10 * 10 = 100

 ==========