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 5 of 5

Thread: How Do I print this shape with for loop

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How Do I print this shape with for loop

    8
    6 ,7
    4 ,6 ,8
    2 ,5 ,8 ,11


    thanks for helpers


  2. #2
    Junior Member
    Join Date
    Dec 2013
    Posts
    7
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: How Do I print this shape with for loop

    Can you explain a little bit more about what you mean by "this shape"? If you want code that prints that exact output, what you probably want to do is make two for loops, inside of each other, so that one for loop prints all the values in an array, and then the outer for loop increments to the next array. The whole thing might be a bit easier if you know how to use a matrix, and if you don't, I think it would be simple enough to teach you!

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How Do I print this shape with for loop

    I want this triangle to be the out output with no array just for loops
    plz, can you right me a java code?
    I try it hours but I didn't suceeded

  4. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,712
    My Mood
    Mellow
    Thanks
    172
    Thanked 622 Times in 609 Posts

    Default Re: How Do I print this shape with for loop

    Welcome to the forum!

    Show what you've tried. Include any errors you're getting and would like help with or questions you have about your code and its results. A sample run is often helpful.

  5. #5
    Member andbin's Avatar
    Join Date
    Dec 2013
    Location
    Italy
    Posts
    443
    Thanks
    4
    Thanked 122 Times in 114 Posts

    Default Re: How Do I print this shape with for loop

    Quote Originally Posted by tomer567 View Post
    I want this triangle to be the out output with no array just for loops
    The problem is not the two for loops! The real issue is to evaluate if those numbers must be "calculated" or derived in some way.
    Looking at those numbers I can "see" a relation between them (but I can't know for sure if it is really what was expected) ..... do you see?
    Andrea, www.andbin.net — SCJP 5 (91%) – SCWCD 5 (94%)

    Useful links for Java beginners – My new project Java Examples on Google Code

Similar Threads

  1. Beginner : Using a loop to print object array
    By trancecommunity in forum What's Wrong With My Code?
    Replies: 6
    Last Post: February 5th, 2013, 05:31 PM
  2. help with loop to print an equliateral asterisk triangle
    By everyone0 in forum Loops & Control Statements
    Replies: 13
    Last Post: October 11th, 2012, 12:37 PM
  3. I need to create a certain SHAPE with FOR LOOP.
    By Rage1337 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: August 4th, 2012, 09:15 AM
  4. Replies: 1
    Last Post: October 16th, 2010, 03:32 PM
  5. [SOLVED] how to print for-loop output to JTextArea
    By voltaire in forum AWT / Java Swing
    Replies: 2
    Last Post: May 13th, 2010, 02:43 PM