# Two-Dimensional Array and Loops

• February 5th, 2011, 02:52 AM
astrojunk
Two-Dimensional Array and Loops
Hi.. Is it possible to assign values to a multi-dimensional array via a loop? The first column contains the numbers 1,2,3,4,5, the second column contains the numbers 100,200,300,400,500, and the third column contains the products of the first and second column. How do I assign those values to an array using loops? Thanks..

1 100 100
2 200 400
3 300 900
4 400 1600
5 500 2500
• February 5th, 2011, 04:17 AM
DanBrown
Re: Two-Dimensional Array and Loops
Quote:

Hi.. Is it possible to assign values to a multi-dimensional array via a loop? The first column contains the numbers 1,2,3,4,5, the second column contains the numbers 100,200,300,400,500, and the third column contains the products of the first and second column. How do I assign those values to an array using loops? Thanks..
Quote:

Nothing is Impossible , but we just don't know how to do it yet.
Instead of going row wise , go column wise.
usually we assign values row wise , using two loops

outer loop for row and inner loop for column.

use outer loop for column and inner loop for row.
• February 11th, 2011, 06:18 AM
c.P.u1
Re: Two-Dimensional Array and Loops
post edited...