I need to implement a recursive method printDigits that takes an integer num as a parameter and prints its digits in reverse order, one digit per line.
This is what
This should work
int rev = 0; int reverse(int num) { if (num < 10) { rev = rev*10 + num; } else { rev = rev*10 + (num % 10); num = reverse(num / 10); } return rev; }