can any body please tell me that how to take input size of a matrix in 2 d array an then print the table of it....

sample output
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25

Recommended Answers

All 2 Replies

You should loop through its indices.

Let's say you enter the number 5. That means you need to print 5 rows and each row has 5 numbers. The first number on the row tells you how to show the numbers on that row, for example row 1 all the numbers are in sequence 1,2,3,4 and 5. Row 2 you print every other number, such as 2, 4, 6, 8, and 10.

You don't actually use an array or matrix to do this.

I think the simplest way to solve this problem is to use two nested loops

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.