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:
and that makes a diamond with height 5 that looks like: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"); }
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.Code:* *** ***** *** *



LinkBack URL
About LinkBacks


