Octal Output in C

Level 253 keystrokes

Prints the number 64 in decimal with %d and in octal (base 8) with %o: "Dec: 64, Oct: 100".

C code

// 64 = 1 * 8 * 8, so in octal (base 8) it is written 100
1int num = 64;
// The same value is printed twice: %d as decimal (64), %o as octal (100)
2printf("Dec: %d, Oct: %o\n", num, num);

Output

Dec: 64, Oct: 100
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.

  • ,× 3
  • ;× 2
  • :× 2
  • "× 2
  • %× 2
  • (× 1
  • )× 1
  • \× 1
  • =× 1

More C examples at level 2

← C typing practice