vendredi 30 mars 2018

How do I code a triangle

I need to make a program which creates a hollow triangle like so (c programming)

*
**
* *
*  *
*   *
******

The user can enter a size (the one above is size 6) and it draws a triangle. So if the user enter's 6, it draws it 6 high and has a 6 character base.

I can draw the height down, and the base, but not the diagonal line.

I can only use while loops, if statements printf and scanf.

Aucun commentaire:

Enregistrer un commentaire