Posted by : Unknown
Wednesday, February 3, 2016
Ans:
#include <stdio.h>
int main()
{
int i, j, n;
//Reads number of rows to be printed from user
printf("Enter number of rows: ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
for(j=1; j<=i; j++)
{
if(j==1 || j==i || i==n)
{
printf("*");
}
else
{
printf(" ");
}
}
printf("\n");
}
return 0;
}
Related Posts :
- Back to Home »
- Star Patterns »
- 39.Hollow Right Triangle using *'s as shown below.