It is possible to solve this issue with only one loop, although it requires more variables.
Follows a possible solution:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int total = 10;
char letra = '*';
char *retorno;
retorno = (char *) malloc(total + 1);
for (int i=0; i<total; i++) {
retorno[i] = letra;
retorno[i+1] = '\0';
printf("%s\n", retorno);
}
return 0;
}
Already with two ties, maybe it’s easier to understand:
#include <stdio.h>
int main()
{
int total = 10;
char letra = '*';
for (int i=0; i<total; i++) {
for (int j=0; j<=i; j++){
printf("%c", letra);
}
printf("\n");
}
return 0;
}
I apologize if I blew the question (since I myself voted to close it because it is not very clear), but the comments do not me
allowed to pass..
Do you have the code snippet you made? Try to explain your question better
– Andre Lacomski
it is necessary to do two loop repetition. If the question is not answered, when I get home I send the answer
– Andre Lacomski
@Andrelacomski doesn’t need two ties to do this
– Ricardo Pontual