Boston Numbers code seem to work but not getting all test cases correct

The code seems to work but still giving not passing all test cases.

@shivambehl123 you have missed on case
for(ll i = 2; i <sqrt(m); i++){
while(n%i == 0){
n = n/i;
int a = i;
//cout<<a<<endl;
while(a){
sum += a%10;
a /= 10;
}
}
}
suppose after this loop still n lefts and n>2 than more factors can be there
hence you have to apply one more condition after this loop that is :
if (n > 2)
{ while(n>0)
{
sum=sum+(n%10);
n/=10;
}} just now ✓
Rest your approach is correct
Hope you get my point and if there is still doubt feel free to ask and please rate me :slight_smile:

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.