/* Program to print the following output
*****
****
***
**
*
**
*
**
***
****
*****
*/
#include <stdio.h>
int main()
{
int i, j;
//Prints the upper part of the arrow
for(i=1; i<=5; i++)
{
//Prints trailing (5-rownumber) spaces
for(j=1; j<=(5-i); j++)
{
printf(" ");
}
//Prints inverted right triangle
for(j=i; j<=5; j++)
{
printf("*");
}
printf("\n");
}
//Prints bottom part of the arrow
for(i=1; i<=5; i++)
{
//Prints trailing (rownumber-1) spaces
for(j=1; j<i; j++)
{
printf(" ");
}
//Prints the right triangle
for(j=1; j<=i; j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
This comment has been removed by a blog administrator.
ReplyDelete