Modulo in Kotlin

Level 115 keystrokes

Prints the remainder when 17 is divided by 5.

Kotlin code

// % returns the remainder of a division
// 17 = 5 × 3 + 2, so this prints 2
1println(17 % 5)

Output

2
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 Kotlin code and how often they appear.

  • (× 1
  • )× 1
  • %× 1

More Kotlin examples at level 1

← Kotlin typing practice