Boston number wrong answer in a testcase

https://ide.codingblocks.com/#/s/13964
https://hack.codingblocks.com/contests/c/452/1103
#include
using namespace std;
int main() {
unsigned long long int n,dsum=0,psum=0,i,temp;
cin>>n;
temp=n;
while(temp>0){
dsum=dsum+temp%10;
temp=temp/10;
}
while(n%2==0){
n=n/2;
psum=psum+2;
}
temp=n;
for(i=3;i*i<=temp;i=i+2){
while((n%i==0) && (n>1)){
psum=psum+i;
n=n/i;
}
if(n<2)
break;
}

if(dsum==psum)
cout<<"1";
else
cout<<"0";
return 0;

}

Hey Amritanshu ! there is some issue with your logic , your code is giving output 0 for n=22 but it should be 1 as the sum of the digits of prime factors (2,11) is 2+1+1=4 which is equal to sum of digits of n=22.
So, try to fix these first.
Got it ??