12345678910111213
int m=12345; while(m>0) { d=m%10; cout<<"d="<<d; m/=10; cout<<"m="<<m; n=10*n+d; cout<<"n="<<d; } cout<<n<<endl;
d= 5 m= 1234 n= 5 d= 4 m= 123 n= 4 d= 3 m= 12 n= 3 d= 2 m= 1 n= 2 d= 1 m= 0 n= 1 54321 Press any key to continue . . .