Page 781 - AP Computer Science A, 7th edition
P. 781
26. (D) The algorithm works by stripping off the rightmost digit of n (stored in rem), multiplying the current value of revNum by 10, and adding that rightmost digit. When n has been stripped down to no digits (i.e., n == 0 is true), revNum is complete. Both segments II and III work. Segment I fails to produce the right output whenever the input value n has first digit less than (number of digits − 1). For these cases the output has the first digit of the original number missing from the end of the returned num ber.