# C++ Program to Print the Multiplication Table in Triangular Form

To memorise the few fundamental multiplication results in tabular or graphic form, use multiplication tables. This article will cover how to produce a multiplication table in C++ that looks like a right-angled triangle. In a select few situations where a larger number of results may be easily memorised, triangular representation is effective. In this format, a table is shown row by row and column by column, with each row containing only the entries that fill that column.

To solve this problem, we need basic looping statements in C++. For displaying the numbers in triangular fashion, we need nested looping to print each line one after another. We will see an approach to solve this. Let us see the algorithms and implementations for better understanding.

## Algorithm

• Take the number of lines we want for multiplication table, say n.
• For i ranging from 1 to n, do the following.
• For j ranging from 1 to i, do the following − i. Display (i * j).
• End for.
• End for.

## Example

#include <iostream>
using namespace std;

void solve( int n ) {
int i;
int j;
for( i = 1; i <= n; i++ ) {
for( j = 1; j <= i; j++ ) {
cout << i * j << " ";
}
cout << endl;
}
}
int main(){
solve( 8 );
}


## Output  (With input 8)

1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64


## Output (With input 15)

1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
6 12 18 24 30 36
7 14 21 28 35 42 49
8 16 24 32 40 48 56 64
9 18 27 36 45 54 63 72 81
10 20 30 40 50 60 70 80 90 100
11 22 33 44 55 66 77 88 99 110 121
12 24 36 48 60 72 84 96 108 120 132 144
13 26 39 52 65 78 91 104 117 130 143 156 169
14 28 42 56 70 84 98 112 126 140 154 168 182 196
15 30 45 60 75 90 105 120 135 150 165 180 195 210 225


## Conclusion

Row I with column j are multiplied in a triangular multiplication table. As a result, the multiplication table with the input of 8 will produce 8 rows in which each element has multiplied by 1 to the row number itself. The triangle is formed using two nested loops, which is a very simple method. We also produce triangle designs in the same way.