Results 1 to 7 of 7
  1. #1
    lagowon is offline Member
    Join Date
    Nov 2011
    Posts
    4
    Rep Power
    0

    Default new to java and needs help on loop

    it display the output below

    1 2 3 4
    2 4 6 8
    3 6 9 12
    4 8 12 16

  2. #2
    lagowon is offline Member
    Join Date
    Nov 2011
    Posts
    4
    Rep Power
    0

    Default Re: new to java and needs help on loop

    dis is what i got and it is not working

    public class loop1

    {

    public static void main(String args[])

    {

    int i,j,k,l;

    for(i=1;i<=4;i+=1)

    {

    for(j=2;j<=8;j+=2)
    {

    for(k=3;k<=12;k+=3)

    {

    for(l=4;l<=16;l+=4)

    {

    System.out.println( + i + " "+ j + " " + k +" "+l);

    }

    System.out.println( );

    }



    }

    }
    }
    }

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,602
    Rep Power
    23

    Default Re: new to java and needs help on loop

    Can you explain your problem?
    Do you have any questions?
    If you are having problems, show your programs output with your question.

  4. #4
    dinesh.guntha is offline Member
    Join Date
    May 2011
    Posts
    27
    Rep Power
    0

    Default Re: new to java and needs help on loop

    You Concentrate on logic. it help more.
    code it will help you.
    for (int i =1; i <5;i++) {
    for (int j=1;j<5;j++) {
    System.out.print(i*j);
    }
    System.out.println();
    }

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,602
    Rep Power
    23

    Default Re: new to java and needs help on loop

    What is the code you posted for? Are you trying to help the OP solve his problem? Or are you giving him a solution?
    You need to explain what your code does and how to figure out the solution.
    Just posting code does not help the OP learn how to solve programming problems.
    You don't learn much with copy and paste.

  6. #6
    lagowon is offline Member
    Join Date
    Nov 2011
    Posts
    4
    Rep Power
    0

    Default Re: new to java and needs help on loop

    tnks for ur assist

  7. #7
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default Re: new to java and needs help on loop

    Quote Originally Posted by Norm View Post
    You don't learn much with copy and paste.
    It would seem OP is not interested in learning.

Similar Threads

  1. Replies: 2
    Last Post: 11-07-2011, 02:25 AM
  2. Replies: 1
    Last Post: 10-01-2011, 02:12 AM
  3. Using while loop in Java?
    By popeyito18 in forum New To Java
    Replies: 4
    Last Post: 06-26-2011, 02:15 AM
  4. for loop in java
    By newjava in forum New To Java
    Replies: 7
    Last Post: 12-16-2009, 10:39 AM
  5. Help with loop in java
    By trill in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 07:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •