Nested Loops in C

Level 4113 keystrokes

Uses nested for loops to create a 3x3 multiplication table.

C code

// Outer loop controls rows (1 to 3)
1for (int i = 1; i <= 3; i++) {
// Inner loop controls columns (1 to 3)
2 for (int j = 1; j <= 3; j++) {
// Print multiplication: row * column = result
3 printf("%d*%d=%d ", i, j, i * j);
4 }
// Print newline after each row completes
5 printf("\n");
6}

Output

1*1=1 1*2=2 1*3=3 
2*1=2 2*2=4 2*3=6 
3*1=3 3*2=6 3*3=9
Practice typing this code

Practice typing this code. Results are not recorded in the rankings.

Symbols in this code

The symbols you type in this C code and how often they appear.

  • ;× 6
  • =× 5
  • "× 4
  • (× 4
  • )× 4
  • +× 4
  • ,× 3
  • %× 3
  • {× 2
  • }× 2

More C examples at level 4

← C typing practice