#include
using namespace std;
void aa(int n)
{if(n>0&&n<10) return n;
else {cout<
int main()
{int m;
cin>>m;
aa(m);
return 0;
}
从后往前除10取余输出不就好了?
python:
def rev(n):
s = str(n)
if len(s) == 1:
return s
else:
i = len(s)-1
n = int(s[0:i])
return s[-1] + rev(n)