Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Two-Dimensional Array and Loops

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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
    Last edited by astrojunk; February 5th, 2011 at 03:58 AM.


  2. #2
    Member DanBrown's Avatar
    Join Date
    Jan 2011
    Posts
    134
    My Mood
    Confused
    Thanks
    1
    Thanked 12 Times in 12 Posts

    Thumbs up Re: 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..
    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.
    Thanks and Regards
    Dan Brown

    Common Java Mistakes

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    10
    Thanks
    11
    Thanked 0 Times in 0 Posts

    Default Re: Two-Dimensional Array and Loops

    post edited...
    Last edited by c.P.u1; February 11th, 2011 at 10:20 AM.

Similar Threads

  1. Finding the length of a two dimensional array
    By petemyster in forum Java Theory & Questions
    Replies: 2
    Last Post: December 12th, 2010, 10:21 PM
  2. Array and loops.
    By Melawe in forum Loops & Control Statements
    Replies: 46
    Last Post: August 15th, 2010, 03:49 PM
  3. How to write 2 dimensional array of float numbers to binary file?
    By Ghuynh in forum File I/O & Other I/O Streams
    Replies: 4
    Last Post: June 17th, 2010, 04:26 PM
  4. 2 dimensional array alternative ???
    By zeeshanmirza in forum Java SE APIs
    Replies: 1
    Last Post: February 23rd, 2010, 06:18 PM
  5. Multi Dimensional Array help NEEDED URGENT
    By bonjovi4u in forum Loops & Control Statements
    Replies: 5
    Last Post: February 13th, 2010, 12:44 AM