Hi, I'm fairly new to C and I'm making some triangles. The problem I have is that I need to make this:
Here is the code I've been playing around with:Code:******************* ***************** *************** ************* *********** ********* ******* ***** *** *
I've already been through loads and loads playing with different numbers etc but I can never get it to look like above. What am I supposed to do?Code:for (row = 10; row >= 1; row--) { for (spaces = 10; spaces <= row; spaces++) printf(" "); for (column = 1; column <= (row*2-1); column++) printf("*"); printf("\n"); }
While I'm here, for this triangle:
I used this code:Code:******************* ***************** *************** ************* *********** ********* ******* ***** *** *
Notice I missed out the spaces loop. Is that OK or should I include it (even though it does nothing).Code:for (row = 1; row <= 10; row++) { for (column = 1; column <= (row*2-1); column++) printf("*"); printf("\n"); }
Thanks in advance



LinkBack URL
About LinkBacks




