Uppercase to Lowercase in C

Level 278 keystrokes

Converts the uppercase letter 'G' to lowercase by adding 32, the distance between the two cases in ASCII, and prints "G -> g".

C code

// 'G' has the ASCII code 71
1char upper = 'G';
// Lowercase letters are 32 codes after uppercase ones: 71 + 32 = 103, which is 'g'
2char lower = upper + 32;
// %c prints both values as characters: "G -> g"
3printf("%c -> %c\n", upper, lower);

Output

G -> g
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
  • =× 2
  • -× 1
  • (× 1
  • )× 1
  • \× 1

More C examples at level 2

← C typing practice