1. ## Need help!

New user to the boards, and I'm also new to c...but anyhow.

I recently started to try and teach myself C out of an old school book one of my friends had, and I have a problem I'm trying to figure out.
The output that I am trying to display looks like this:

--------------------------------------
| * |
| * * |
| * * * |
| * * * * |
| * * * * * |
----------------------------------------

only I need it centered.

if anyone can help me out I'd greatly appreciate it!

Thanks!

2. you may notice that the spaces required to 'center' the lines may be inversely proportional to the number of stars you want to print.

that is, the first line has the most spaces, say n, then you print a star. the second line has n - 1 spaces, then you print 2 stars, etc,. the last line has no spaces, then you print all x stars.

draw out some examples on paper and you may notice a pattern. heres examples, but try yourself. note i will use .'s in place of spaces.
x = 2 stars
.*
**

x = 3 stars
..*
.**
***

x = 4 stars
...*
..**
.***
****
at times it doesnt look perfectly even, but it cant be. you either have to have spaces between the group of *'s or only use odd number of *'s (as opposed to odd and even here), example:
.....*
...***
.*****
*******

3. ## Solution

Code:
```#include <stdio.h>

int main (){
int counter;
int counter2;

system("clear"); //clear the consol
for (counter=1; counter < 6; counter++){
printf("| ");
for(counter2=1; counter2<= counter; counter2++)
printf("* ");
printf("|\n");
}

return 0;
}```

4. @cs05pp2 - read the rules. We're here to help people learn by doing programs for themselves, not hand out complete answers on demand.