Nested Loops and Patterns
Loops inside loops draw tables and shapes.
Example
#include <stdio.h>
int main(void) {
for (int r = 1; r <= 3; r++) {
for (int c = 1; c <= r; c++) printf("*");
printf("\n");
}
return 0;
}Result
* ** ***
Exercise
Inner loop variable.
for (int c = 1; c <= ; c++)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.