Negative Number in C

Level 120 keystrokes

Outputs a negative integer using the %d format specifier.

C code

// %d handles both positive and negative integers
// The minus sign is included in the output
1printf("%d\n", -42);

Output

-42
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
  • -× 1
  • ,× 1
  • ;× 1
  • (× 1
  • )× 1
  • \× 1
  • %× 1

More C examples at level 1

← C typing practice