← Unit 1 · all exercises
Saved in this browser only

Tens digit

Return the tens digit of a positive whole number. For 4728 that is 2. You will need both / and %.

int tensDigit(int n)

Solution.java
Loading editor…
Results

Examples

  • tensDigit(4728) → 2
  • tensDigit(95) → 9

There are also 3 hidden tests you can't see. Solve the problem, not the examples.