Skip to main content

Practice · 4 of 4

Last digit as a char

CHALLENGE
Difficulty: beginner+25 XP

Implement char lastDigitChar(int n): the last digit of non-negative n, returned as a char ('7', not 7). % gives the digit; adding '0' converts a digit to its character.

Back to lesson: Practice: Typed storage