2. Initialize i=1.
3. Repeat through step 9 until i is less than or equal to
row
.
4. Initialize j=1.
5. Repeat through step 7 until j is less than or equal to i.
6. Print j.
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=1; i<=row; i++)
{
for(j=1; j<=i; j++)
{
printf(“%d”, j);
}
printf(“\n”);
}
}
}
Do'stlaringiz bilan baham: