Multiple Printf Calls in C

Level 259 keystrokes

Calls printf three times; each string ends with \n, so "Line 1", "Line 2" and "Line 3" appear on separate lines.

C code

// printf does not add a newline by itself; the \n at the end moves to the next line
1printf("Line 1\n");
// Prints the second line, "Line 2"
2printf("Line 2\n");
// Prints the third line, "Line 3"
3printf("Line 3\n");

Output

Line 1
Line 2
Line 3
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
  • ;× 3
  • (× 3
  • )× 3
  • \× 3

More C examples at level 2

← C typing practice