Results 1 to 14 of 14
  1. #1
    coding is offline Member
    Join Date
    Jan 2011
    Posts
    40
    Rep Power
    0

    Default How do I go about do this?

    Got my help. Thanks.
    Last edited by coding; 03-08-2011 at 04:39 AM.

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    So you can only use system.out.print? This isnt too difficult, use the first loop to split lines and second line to print the *'s, it's hard to give you advice without spoiling it. Look up new line escape character

  3. #3
    coding is offline Member
    Join Date
    Jan 2011
    Posts
    40
    Rep Power
    0

    Default

    Lol, I don't mind you spoiling it. Go more indepth.

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I generally try not to spoil it for a different reason. You will be greatly helped if you think it through. Show me some startup code of your best attempt and then I will give more advice. A hint I will give is that the second loop should use the first loops variable in it's conditional.

  5. #5
    coding is offline Member
    Join Date
    Jan 2011
    Posts
    40
    Rep Power
    0

    Default

    Would I put one star and then make it equal to a variable and then increment it? Confuses me.

  6. #6
    al_Marshy_1981 is offline Senior Member
    Join Date
    Feb 2010
    Location
    Waterford, Ireland
    Posts
    748
    Rep Power
    5

    Default

    use a 2 for loops only
    good clue maybe

  7. #7
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Explain to me what should be done; how many times should the first loop go? How many stars are on line 1? 2? 3? Notice anything interesting? The second loop does the star printing. I gave you a lot of hints here, now show me some code of your first attempt.
    Last edited by sunde887; 03-05-2011 at 02:22 AM.

  8. #8
    coding is offline Member
    Join Date
    Jan 2011
    Posts
    40
    Rep Power
    0

    Default

    I'll work on it tomorrow. I'm tired now. I will post what I have tomorrow.

  9. #9
    mobosecomin is offline Member
    Join Date
    Oct 2010
    Posts
    23
    Rep Power
    0

    Default

    i only looked at this problem a few months ago it confused me for a bit to but its worth it when you figure it out. for loops and nested loops then become allot easier.

  10. #10
    coding is offline Member
    Join Date
    Jan 2011
    Posts
    40
    Rep Power
    0

    Default

    Still need help.
    for (int i=1;i<10;i++) {
    for (int j=1;j<=i;j++) {
    print star
    }
    print newline
    }
    finish

    Am I doing it right? Any more help

  11. #11
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Thats exactly what you want to do, now translate it into actual code, then compile it and run it and see what happens.

  12. #12
    coding is offline Member
    Join Date
    Jan 2011
    Posts
    40
    Rep Power
    0

    Default

    Thanks but how would I show this?

  13. #13
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    I don't see what you are referring to. First, did you solve your second program? Finally, how would you go about this?

  14. #14
    coding is offline Member
    Join Date
    Jan 2011
    Posts
    40
    Rep Power
    0

    Default

    Well I got the second one working for the most part. I will show the finished version later. but the other one I'm working on now looks like a christmas tree and the way it looks on the right side looks like that on the left. Basically the why the star is arranged in the first one is the same on the left.

Posting Permissions

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