#include

using namespace std;

int main(){

int t;

cin>>t;

for(int test=0;test<t;test++){

long long int n;

cin>>n;

long long int sum=n%10;

while(n!=0){

int n=n/10;

if(n<10){

sum=sum+n;

}

}

cout<<sum<<endl;

}

}

#include

using namespace std;

int main(){

int t;

cin>>t;

for(int test=0;test<t;test++){

long long int n;

cin>>n;

long long int sum=n%10;

while(n!=0){

int n=n/10;

if(n<10){

sum=sum+n;

}

}

cout<<sum<<endl;

}

}

You have already declared n as a long long int type and inside the while loop, you are again declaring n but now as an int type. That’s why you’re getting SIGSTP error.

To overcome this, simply remove the **int** inside the while loop. Insead of writing **int n=n/10;** just write **n=n/10;** and your problem will be resolved.

Also since you’re using int main, you should also return a value at the end. Return 0 here. It’s a good practise