Posted by : Unknown
Wednesday, February 3, 2016
Ans:
#include <stdio.h>
int main()
{
int i, j, n;
//Reads total number of rows from user
printf("Enter value of n: ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
//Prints spaces before star gets printed
for(j=i; j<n; j++)
{
printf(" ");
}
//Prints star after spaces gets printed
for(j=1; j<=n; j++)
{
printf("*");
}
//Moves to the next line/row
printf("\n");
}
return 0;
}