A Boston number is a composite number, the sum of whose digits is the sum of the digits of its prime factors obtained as a result of prime factorization (excluding 1 ). Write a program to check whether a given integer is a Boston number

#include
#include
#include
#include
#include
using namespace std;

int main() {
int n, sum=0, sum_n=0;
cin>>n;
int temp=n;

while(temp>0){
    sum_n=sum_n+(temp%10);
    temp/=10;
}
while (n%2 == 0){
    sum+=2;
    n = n/2;
}
for (int i = 3; i <= sqrt(n); i = i+2){
    while (n%i == 0){
        int temp1=i;
        while(temp1>0){
            sum=sum+(temp1%10);
            temp1/=10;
        }
        n = n/i;
    }
}
if (n > 2){
    while(n>0){
        sum=sum+(n%10);
        n/=10;
    }
}

if(sum_n==sum)
    cout<<"1";
else
    cout<<"0";
return 0;

}