Sum of Variables in C

Level 252 keystrokes

Declares three int variables with the values 10, 20 and 30 and prints their sum, 60.

C code

// Declares three ints in one line, separated by commas: a = 10, b = 20, c = 30
1int a = 10, b = 20, c = 30;
// The sum 10 + 20 + 30 is computed first and printed as 60 (no newline)
2printf("%d", a + b + c);

Output

60
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
  • =× 3
  • ;× 2
  • "× 2
  • +× 2
  • (× 1
  • )× 1
  • %× 1

More C examples at level 2

← C typing practice