Can anyone Please tell where I am wrong... Problem Code: FLOW004 First and Last Digit error-(SIGSTP)

#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;
}

}