Results 1 to 9 of 9
  1. #1
    jnjh is offline Member
    Join Date
    Mar 2011
    Posts
    12
    Rep Power
    0

    Default Printing triangles with * patterns

    Hi all,

    I am new to java and i was trying to print the right angled triangle and the mirror image of right angled triangle with * pattern. plz help me out..

    Thanks in advance..

  2. #2
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Well I suggest you create a loop that manipulates asterisks into the form of a triangle. You need any more help?
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  3. #3
    jnjh is offline Member
    Join Date
    Mar 2011
    Posts
    12
    Rep Power
    0

    Default

    thank u very much dark.... i have done right angled triangle...yeah i need some help for the mirror image of that..

    Thanks

  4. #4
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Ok, well then what do you need help with in detail? We don't write code for people here, we help them write their own code.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  5. #5
    jnjh is offline Member
    Join Date
    Mar 2011
    Posts
    12
    Rep Power
    0

    Default

    ok can u plz tel d idea for implementing d for loop foe dat program???

  6. #6
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Well that depends, what have you tried so far?
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  7. #7
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default

    Quote Originally Posted by jnjh View Post
    ok can u plz tel d idea for implementing d for loop foe dat program???
    Please go through this web page.

    db

  8. #8
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Quote Originally Posted by DarrylBurke View Post
    Please go through this web page.

    db
    That website makes me happy in more way than one. Definitely bookmarking it for future reference.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

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

    Default

    Quote Originally Posted by jnjh View Post
    I am new to java and i was trying to print the right angled triangle and the mirror image of right angled triangle with * pattern. plz help me out..
    I bet you're cramming all your loops and tests in your main( ... ) method; don't do that. For starters have a look at this little method:

    Java Code:
    private static void printChars(char c, int n) {
       for (int i= 0; i < n; i++)
          System.out.print(c);
    }
    This method can be a building block for all shapes you want to print.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Triangles wont draw Help?
    By The_Sponzy_Paradox in forum Java 2D
    Replies: 9
    Last Post: 03-22-2010, 02:42 AM
  2. Triangles java problem (basic help)
    By adz06 in forum New To Java
    Replies: 5
    Last Post: 10-31-2009, 06:58 PM
  3. Drawing out triangles
    By leiferouis in forum New To Java
    Replies: 24
    Last Post: 01-16-2009, 08:18 PM
  4. Triangles
    By CodeDog in forum New To Java
    Replies: 9
    Last Post: 10-14-2008, 09:18 PM
  5. asterisks triangles
    By Dan121 in forum New To Java
    Replies: 1
    Last Post: 01-12-2008, 07:42 PM

Posting Permissions

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