Hello there everyone. I am in need of assistance in writing a code for my program. What I have to do is write a code to generate the following:
(1)
*
**
***
****
*****
(2)
*****
****
***
**
*
(3)
*****
****
***
**
*
(4)
*
**
***
****
*****
So far I was able to make a code for (1) and (2) which is:
for(a=0; a<5; a++)
{
for(b=0; b<=a; b++)
printf("*");
printf("\n");
}
for(a=5; a>0; a--)
{
for(b=0; b<a; b++)
printf("*");
printf("\n");
}
Now I have been trying to write code for (3) and (4) but I am unsuccesful. Can anyone guide me in the right direction. Also can someone explain how this works so that in the future I can be quick and efficient. Thank You.
The (3) is supposed to have a triangle that looks like \|
and (4) is supposed to have a triangle that looks like /|
Sorry, but the editor wont let me show the stars the way I want it to