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

Thread: How would I set up a loop to draw a triangle using *'s given a user entered size

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How would I set up a loop to draw a triangle using *'s given a user entered size

    Example Run 1:
    Shape? triangle
    Size? 4
       *
      ** 
     *** 
    ****

    (those _'s are suppose to represent blank spaces)

    I am guessing I need to set up a loop to draw the spaces and then one to do the stars
    Last edited by BuckNasty87; February 16th, 2011 at 07:55 PM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,237
    Thanks
    176
    Thanked 817 Times in 760 Posts
    Blog Entries
    5

    Default Re: How would I set up a loop to draw a triangle using *'s given a user entered size

    Please don't post the same question twice. Your other post has been deleted.

    As for you question, did you search the forums? Try search for "triangle asterisk", there are a few older posts you might be interested in reading.

  3. #3
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 287 Times in 225 Posts
    Blog Entries
    4

    Default Re: How would I set up a loop to draw a triangle using *'s given a user entered size

    Also scroll down to the bottom of this thread.. There is a Similar Threads box which contain the answers to your question
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

    Looking for a Java job? Visit - Java Programming Careers

Similar Threads

  1. Triangle printing (for loop)
    By thirdwave in forum Loops & Control Statements
    Replies: 2
    Last Post: December 6th, 2010, 03:07 PM
  2. Replies: 1
    Last Post: December 4th, 2010, 04:26 PM
  3. help me draw a triangle....
    By beandip408 in forum Object Oriented Programming
    Replies: 10
    Last Post: October 28th, 2010, 05:49 PM
  4. g.drawLine doesn't draw line in for loop
    By shumpi in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 12th, 2010, 06:15 PM
  5. [SOLVED] Trouble with draw and fillRect in pyramid logic using nested loop
    By LiquidMetal in forum Loops & Control Statements
    Replies: 4
    Last Post: April 27th, 2009, 03:25 AM