Division Assignment in C

Level 263 keystrokes

Divides amount (100) by 4 with the compound assignment operator /= and prints "Quarter: 25".

C code

// amount starts at 100
1int amount = 100;
// /= divides the variable by the right side: amount = amount / 4, now 25
2amount /= 4;
// Prints a quarter of 100: "Quarter: 25"
3printf("Quarter: %d\n", amount);

Output

Quarter: 25
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
  • ,× 1
  • :× 1
  • (× 1
  • )× 1
  • /× 1
  • \× 1
  • %× 1

More C examples at level 2

← C typing practice