- #1
RicardoMarques
- 20
- 2
< Mentor Note -- code tags have been added for better readability. In the future, please use code tags. Thank you. >
1. Homework Statement
How do I turn this code into a triangle with asteriscs like this:
*
**
***
****
Going on and on...?
There are no equations
I tried to change the parameters but has been way too difficult
1. Homework Statement
Code:
#include <stdio.h>
void escreve_linha(int n)
{
int i;
for( i = 0 ; i < n ; i++ ) {
printf("*");
}
printf("\n");
}
void escreve_quadrado(int n)
{
int i;
for( i = 0 ; i < n ; i++ ) {
escreve_linha(n);
}
}
int main(void)
{
int lado;
printf("Qual o tamanho do lado? ");
scanf("%d", &lado);
escreve_quadrado(lado);
return 0;
}
How do I turn this code into a triangle with asteriscs like this:
*
**
***
****
Going on and on...?
Homework Equations
There are no equations
The Attempt at a Solution
I tried to change the parameters but has been way too difficult
Last edited by a moderator: