1
The exercise asks the program to receive an integer n
and print a height drawing 2*n
as follows:
\ * /
\ *** /
\*****/
\***/
\*/
/*\
/***\
/*****\
/ *** \
/ * \
I did the following until the moment:
void arte(int n)
{
int i, barrasE, aux, espacobarrasE, ebE, espaco;
aux = n;
for(i = 1; i <= n; i++)
{
if(aux < n) //Espaços impressos antes das contra barras na parte superior.
{
espacobarrasE = n - aux;
for(ebE = 0; ebE < espacobarrasE; ebE++)
printf(" ");
}
for(barrasE = 1; barrasE <= aux; barrasE++) //Desenha as contra barras na diagonal na parte superior.
{
printf("\\");
break;
}
for(espaco = 1; espaco < n; espaco++)
{
printf(" ");
}
aux = aux - 1;
printf("\n");
}
}
But this only prints against top bars and do not know how to continue. I would like to know the best way to continue.
just to confirm, in this first example, n=5 correct ?
– Rovann Linhalis
Yes, Rovann. n = 5 and a drawing of height 2n = 10.
– Renan