Given a number N, the task is to print N rows where every Kth row consists of the multiplication table of K up to Kth term.
Input: N = 3
3 6 9
In the above series, in every Kth row, multiplication table of K upto K terms is printed.
Input: N = 5
3 6 9
4 8 12 16
5 10 15 20 25
Approach: The idea is to use two for loops to print the multiplication table. The outer loop in ‘i’ serves as the value of ‘K’ and the inner loop in ‘j’ serves as the terms of the multiplication table of every ‘i’. Each term in the table of ‘i’ can be obtained with the formula ‘i * j’.
Below is the implementation of the above approach:
1 2 4 3 6 9 4 8 12 16 5 10 15 20 25
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Space between two rows in a table using CSS?
- Program to print multiplication table of a number
- Recursive Program to print multiplication table of a number
- How to make Bootstrap table with sticky table head?
- Sum of series till N-th term whose i-th term is i^k - (i-1)^k
- Sum of the series 1, 2, 4, 3, 5, 7, 9, 6, 8, 10, 11, 13.. till N-th term
- Program to get the Sum of series: 1 - x^2/2! + x^4/4! -.... upto nth term
- Program for sum of cosh(x) series upto Nth term
- Program to print tetrahedral numbers upto Nth term
- Program to print pentatope numbers upto Nth term
- Sparse Table
- Symbol Table in Compiler
- PHP | MySQL ( Creating Table )
- Convert CSV to HTML Table in Python
- Find the number of cells in the table contains X
- Puzzle | Neighbors in a round table
- Compute the parity of a number using XOR and table look-up
- Program for Binomial Coefficients table
- Permutations to arrange N persons around a circular table
- Program to implement ASCII lookup table
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.