Q9. Write a C program to print the following triangle:
[Hint: Let us develop its algorithm first:
1. Read the number of rows,
row. 2. Initialize i = row.
3. Repeat through step 9 until i is greater than 0.
4. Initialize j=0.
5. Repeat through step 7 until j is less than i.
6. Print “*”.
7. j=j+1
8. Move to new line.
9. i=i–1
10. Stop and exit.
The program is as follows:
void main( )
{
int row, i, j;
printf (“Enter the number of rows:”);
scanf (“%d”, &row);
for (i=row; i>0; i- - )
{
for (j=0; j {
printf(“ * “);
}
printf(“\n”);
}
}
}