# Thread: Simple triangle printer (kinda)

1. Member
Join Date
Aug 2011
Posts
9
Rep Power
0

## Simple triangle printer (kinda)

So for my computer class, my instructor gave me a challenge problem since i was doe with the rest of the work, its the beginning of the year so its kind of simple... but i can't wrap my mind around it. the problem is To create a program that prints out a triangle based on 'n'... for example:

if n = 3,

it would print out:

___*
__**
_***

(the underscore would be the spaces since it won't show up)
anyways, i know it would have to do something with a for loop, but i don't know how to account for the spaces before the stars.

If somebody could tell me a way to go about it or how to figure it out, i would greatly appreciate it.

2. You need to grab a pen and some paper. Draw various n sized triangles and count how many spaces appear before each *. If you do this enough you should see a pattern emerging. Given n then you can calculate what the initial number of spaces will be.

3. Member
Join Date
Aug 2011
Posts
9
Rep Power
0
Thanks, after reading your post i thought of something else completely and suddenly i figured it out... :)
but the counting of spaces helped as well

#### Posting Permissions

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