Learning and reciting multiplication table is always crazy. Here let’s create a multiplication table having 12 rows using C++ programming.
This program first accepts a number that we want to generate multiplication table. We can create multiplication table of any number up to any number of rows. Here we limit the rows up to 12 with any number of multiplication table. You can change the program as you wish.
#include <iostream>
using namespace std;
int main()
{
int num;
cout << "Enter a number : ";
cin>>num;
for(int i=1 ;i<=12;i++)
{
cout<<i<<" x "<<num<<" = "<<num*i<<"\n";
}
return 0;
}
Code Explanation:
Variable num accept the number that you want to display multiplication table.
In for loop, stating number is 1 that is assigned as variable I, and the limit is 12 ( you can change this number as your need). i++ increment the loop from 1 to 12 by one by one.
cout<<i<<” x “<<num<<” = “<<num*i<<“\n”;
- i -means the number form 1 to 12
- ” x “ -just a symbol that donates multiplication.
- num -is the number that we want to generate multiplication table.
- = -just a symbol to display the equal to sign.
- num*i -Here each number (num) is multiplied by i, so we gets the multiplication result.
- \n -generate next line after each row of multiplication.
Sample Output:

I’d incessantly want to be update on new content on this website , saved to favorites! .