Posted by : Unknown
Wednesday, February 3, 2016
*****
****
***
**
*
*
**
***
****
*****
Ans:
#include <stdio.h>
int main()
{
int i, j, n;
//Reads number of rows from user
printf("Enter value of n : ");
scanf("%d", &n);
//Prints the upper part of the arrow
for(i=1; i<=n; i++)
{
//Prints trailing (2*rownumber-2) spaces
for(j=1; j<=(2*i-2); j++)
{
printf(" ");
}
//Prints inverted right triangle star pattern
for(j=i; j<=n; j++)
{
printf("*");
}
printf("\n");
}
//Prints lower part of the arrow
for(i=1; i<=n; i++)
{
//Prints trailing (2*n - 2*rownumber) spaces
for(j=1; j<=(2*n - 2*i); j++)
{
printf(" ");
}
//Prints simple right triangle star pattern
for(j=1; j<=i; j++)
{
printf("*");
}
printf("\n");
}
return 0;
}
**********OUTPUT**********
Enter value of n : 5
*****
****
***
**
*
*
**
***
****
*****
*************************Related Posts :
- Back to Home »
- Star Patterns »
- 24. Right Arrow as using *'s as shown below.