3.Print this pattern
0000
000
00
0
Step 1: Define the number of rows
int rows = 4;
Step 2:Outer loop — controls rows
for (int i = rows; i >= 1; i--)
This loop runs from 4 down to 1.
Variable i tells us how many zeros to print on the current row.
When i=4, print 4 zeros; when i=3, print 3 zeros, and so on.
Step 3:Inner loop — prints zeros
for (int j = 1; j <= i; j++) {
printf("0");
}
For each row, this loop prints zeros.
It runs i times, printing exactly i zeros in that row.
printf("0") prints zeros without moving to the next line.
Step 4:Move to the next line
printf("\n"); //After printing zeros in the current row, this moves the cursor to the next line, so the next row prints below.