# How to draw an euqilateral triangle.

• 10-20-2001
Unregistered
How to draw an euqilateral triangle.
Hey, I've been at this for a few days now and I cannot for the life of me figure this one out.
I need to draw a trinagle with "*" and "-" that looks like this

*--------
**-------
***------
****-----
*****----
****-----
***------
**-------
*--------
it doesn't look like it in the picture but the picture is supposed to be a complete square with and odd number of rows and columns.
I am at my wit's end on this. I don't even know how to begin on this. In the rest of my program I have already used FOR loops to draw other types of triangles, but this one is just killing me. Thank you for any help. It is greatly appreciated.
• 10-20-2001
C_Coder
triangle
this may be a messy way but I'ts the best I can do at this time of night

Code:

```#include <stdio.h> int main() {         int star, dash, x;                 star = 1;         dash = 8;         while(star<6)         {                 for(x = 0; x < star; x++)                         putchar('*');                 for(x = 0; x < dash; x++)                         putchar('-');                 putchar('\n');                 star++;                 dash--;         }         star = 4;         dash = 5;         while(star>0)         {                 for(x = 0; x < star; x++)                         putchar('*');                 for(x = 0; x < dash; x++)                         putchar('-');                 putchar('\n');                 star--;                 dash++;         }         return 0; }```
You can probably improve this, I'll leave that up to you as you should do some homework