I am almost able to reverse the number except the last digit

Please tell me what is the problem in this code.

int main()

{
long long int n,m;

cin>>n;
m=n;
int nod=0;
//int pow=1;
long long sum=0;

while(m){
    int r = m%10;
    ++nod;
    m=m/10;

}
//cout<<nod<<endl;
m=n;

while(m){
        int r = m%10;
        sum = sum + r*pow(10,nod);
        nod--;
        m=m/10;
}
cout<<sum;
return 0;

}