Scheme Exercises
back to exercise list
previous next
Group: Exercise: 9/48
getOnesDigit:
Extract the ones digit from an integer.
Write a function called "getOnesDigit" that takes an integer parameter, and returns the value of the ones digit. (getOnesDigit 125) --> 5 (getOnesDigit 51239) --> 9 (getOnesDigit 2) --> 2 Note: the remainder function does not work on this website, you must use modulo: (modulo a b). Modulo is not the same as remainder but works the same with positive values)
|