I am new to C++ and i am trying to create a recursive function that lists each individual digit in an integer and then provides the sum of those digits and ‘sum’ must be a variable that is passed to the function by reference. My program works but lists the digits in reverse order. How do i change it that the number are displayed in appropriate order? Any advice would be appreciated
> create a recursive function that lists each individual digit in an integer
> My program works but lists the digits in reverse order.
list each individual digit in an integer:
1 2 3 4 5 6 7
input: n, a positive integer
ifn is a single digit number (less than ten), print out n and we are done
ifn has two or more digits (greater than nine):
list each individual digit in the integer n/10 (list every digit except the last digit)
after that, print out the last digit n%10