Chewbacca and number

What is wrong with my code.Can you modify my code
#include
#include
using namespace std;
int main(){
int n,d,s=0,i=1;
cin>>n;
while(n!=0){
d=n%10;
if(d>=5){
d=abs(d-9);
}
s=s+di;
i=i
10;
i++
}
cout<<s;
}

Hey @dips123deepali_c25f140838182212 your logic is right but in line number why are you incrementing i.
instead it should be n = n/10.
and also your have to take long long instead of int
also your have to write for the case if (d==9 and (n/10) == 0) you have to do nothing here but than also you have to write it.
https://ide.codingblocks.com/s/627891 I have corrected your code here and commented out your mistakes please check over here.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Sir,why are we considering n/10==0 as a condition.

because we haven’t considered the case for n = 0 before so if n/10==0 it means n=0 for that we have to do nothing