1. ## A beginner question.

Hello all,

So I am teaching myself C to gain a better understanding of programming, I figured this was the best place to start. Using online courses I've been watching videos and completing lab assignments based on what I've learned. Unfortunately, there is no sort of answer key if I am to get stuck. If you could take the few minutes to help me out here it would be greatly appreciated. To any intermediate programmer, I imagine this question should be cake. The question is as follows:

"Create a third c project. Using a for loop (or for loops)create the following pattern in your output. Note that youshould never output more than one asterisk within a printf()statement in your solution:
1: *
2: **
3: ***
4: ****
5: *****
6: ******
7: *******
8: ********
9: *********
10: **********
11: ***********
12: ************
13: *************
14: **************
15: ***************

Thank you to all who help me out!

2. It sounds like you should have at least been introduced to "for()" loops at this point.

Post your best attempt, and let us know specifically where you're stuck.

>> Using a for loop (or for loops)...

That's actually a pretty good clue.

3. Think like this. Each line has star (*) and space ( ). You need to find proper equations to print them in a loop.

For example:

First line: 1 star 14 spaces
Second line: 2 stars 13 spaces
.
.
.
Fifteenth line: 15 stars 0 spaces

It's easy to see the equations between them. Try it out and post your code if you need further help.

4. Code:
```for (int x=0; x<16; x=x+1)
{
printf("%d: *", x);
printf("\n");
}```
This is what I have been using for the initial number. The lesson i watched included only integers in the for loops. Am I able to use a char object? Do i need to? The repeating star is the only thing i can't figure out.

5. Originally Posted by meatloaf
Code:
```for (int x=0; x<16; x=x+1)
{
printf("%d: *", x);
printf("\n");
}```
This is what I have been using for the initial number. The lesson i watched included only integers in the for loops. Am I able to use a char object? Do i need to? The repeating star is the only thing i can't figure out.
Try my following suggestions:
Code:
```   // In this case, start x at 1 not 0
// x++ or ++x instead of x=x+1, more efficient

for (int x=0; x<16; x=x+1)
{
printf("%d: ", x);

// Add a second for() loop here to print the multiple '*'

printf("\n");
}```
I would align the ':' to make it look cleaner, but not part of the initial assignment you posted.