Float Output in C

Level 123 keystrokes

Outputs the floating-point number 3.14 with 2 decimal places.

C code

// %.2f prints a floating-point value with 2 decimal places
// \n adds a newline at the end
1printf("%.2f\n", 3.14);

Output

3.14
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.

  • .× 2
  • "× 2
  • ,× 1
  • ;× 1
  • (× 1
  • )× 1
  • \× 1
  • %× 1

More C examples at level 1

← C typing practice