55555
4444
333
22
1
[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 i.
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(”%d”, i);
}
printf(“\n”);
}
}
}
Do'stlaringiz bilan baham: