Results 1 to 9 of 9

Thread: pyramid

  1. #1
    Dashinator is offline Member
    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Default pyramid

    I have a question:
    how do you make this:
    Java Code:
    123456
    12345
    1234
    123
    12
    1
    pyramid in java?

    I know how to make
    Java Code:
    1
    12
    123
    1234
    12345
    123456

  2. #2
    javaman1 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default

    All you need to do is use a series of System.out.println() statements in the opposite order you already have.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by javaman1 View Post
    All you need to do is use a series of System.out.println() statements in the opposite order you already have.
    Nah, all the OP needs to do is reverse the top level loop so that it counts down.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    javaman1 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default

    He never said he was using a loop...

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,797
    Rep Power
    19

    Default

    He may not have said it, but surely that output screams LOOP to you?

  6. #6
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by javaman1 View Post
    He never said he was using a loop...
    The OP also never said System.out.println( ... ) was used.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    javaman1 is offline Member
    Join Date
    Sep 2010
    Posts
    56
    Rep Power
    0

    Default

    Everyone has different opinions. :D

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,336
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by javaman1 View Post
    Everyone has different opinions. :D
    I don't, I always have the same opinions as I have.

    kind regards,

    Jos ;-)
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    venerik is offline Member
    Join Date
    Oct 2010
    Posts
    94
    Rep Power
    0

    Default

    I think the OP is sitting on a sunny beach next to Samari412 telling stories of how they got rich of JosAH knowledge...

    ;)

    @OP a thank you to your helpers would be appreciated.
    I'm new to Java but I like to help where ever I can. :)

Similar Threads

  1. Will make a pyramid of some kind out of a number
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:20 AM

Tags for this Thread

Posting Permissions

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