Hit enter after type your search item

3 C++ Programs to Generate Multiplication Tables

Generating Multiplication Tables in C++

In this tutorial, we will show you how to generate multiplication tables in C++. A user is asked to enter the number for which he/she wants to generate the table.

Different logics are used to generate the table to 10 and beyond.

C++ Multiplication table – Program 1 using while loop

In this C++ program, we used a while loop to generate the table of an entered number by the user. As you run this program, it will ask you to enter the number that you want to generate the multiplication table for.

After entering the number, it will generate a table till 10. Have a look at the code and a few sample outputs:

Table of 5:


Table of 10


Table of 25


Program 2 – Using for loop to generate the multiplication table

Now, we used a for loop to generate the table. See the code and output:

Table of 5:



Want to go beyond multiplying by 10?

The following example multiplies the entered number for the table to the given number. In the above examples, we multiplied each given number to the range of 10.

In this example, the user is asked to enter the given number for the table. It also asks to specify the range where it should multiply and then it will display the table. Have a look:

Table of 5 till 22:


This div height required for enabling the sticky sidebar