# Thread: ahh i can't figure out this loop

1. ## ahh i can't figure out this loop

ok i have a loop that will make a diamond, i can't get the freaking dimensions right, i dontk now what to change, i've been fiddlin around with the variables but can't figure out what to change by how much, can anyone help? heres the code:

Code:
```//top of diamond or pyramid
for (row = 1; row <= height1 - (height1/2); row++)
{
for (space = height1; space >= row; space--)
printf(" ");
for (col = 1; col <= (row * 2 - 1); col++)
printf("*");
printf("\n");
}
//bottom of diamond
for (row = 1; row <= height1 - 1; row++)
{
for (space = 1; space <= row + 1; space++)
printf(" ");
for (col = 1; col <= height1 * 2 - (row * 2 + 1); col++)
printf("*");
printf("\n");
}```
and that makes a diamond with height 5 that looks like:
Code:
```   *
***
*****
*******
*****
***
*```
but i need one with height 5 that looks like:
Code:
```  *
***
*****
***
*```
can anyone help? i know this may sound stupid but i've gone trhough and i just can't figure this out.

2. It appears as if you were trying to be too clever with your loops, try something like this:
Code:
```#include <stdio.h>

int main ( void )
{
int space;
int height1 = 5;
int row, col;

//top of diamond or pyramid
for (row = 1; row <= (height1/2 + 1); row++)
{
for (space = height1; space >= row; space--)
printf(" ");
for (col = 1; col <= (row * 2 - 1); col++)
printf("*");
printf("\n");
}

//bottom of diamond
for (row = height1 / 2; row >= 1; row--)
{
for (space = height1; space >= row; space--)
printf(" ");
for (col = 1; col <= (row * 2 - 1); col++)
printf("*");
printf("\n");
}

return 0;
}```
-Prelude