Multiplication Table in C

Level 382 keystrokes

Prints a multiplication table for a given number using a for loop.

C code

// The number whose table is printed
1int n = 5;
// Multipliers 1 to 5
2for (int i = 1; i <= 5; i++) {
// Three %d placeholders are filled in order by n, i and n * i
3 printf("%d x %d = %d\n", n, i, n * i);
4}

Output

5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
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.

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

More C examples at level 3

← C typing practice