Hello my code is passing the all test cases except 2nd test case.Its showing tle.please help me what to change in my code.dont send your code.please try to modify in my program.Thank you!

#include
using namespace std;
long long findsumofDigits(long long sum1){
long long sum=0;
while(sum1>0){
sum=sum+sum1%10;
sum1=sum1/10;
}
return sum;

}
int main(){
long long int arr[1000]={0},i=0,n=0,val=0,c=0,sum=0,sum1=0;
cin>>n;
for(i=2;i<=n;i++){
if(n%i==0){
c++;
arr[val++]=i;
}
}
if(c+1>2){
long long mid=n;
i=0;
while(mid!=1){
if(mid%arr[i]==0){
sum+=findsumofDigits(arr[i]);
mid=mid/arr[i];
}
else
i++;
}
sum1= findsumofDigits(n);
if(sum==sum1)
cout<<1;
else
goto label;

}
else{
label:
cout<<0<<endl;
}
}

hi @anishravula660
try this -->

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */ 
    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;
}

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.