Multiplication table till N rows where every Kth row is table of K upto Kth term
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
Hey! Looking for some great resources suitable for young ones? You've come to the right place. Check out our self-paced courses designed for students of grades I-XII.
Start with topics like Python, HTML, ML, and learn to make some games and apps all with the help of our expertly designed content! So students worry no more, because GeeksforGeeks School is now here!
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