It is showing WA.
here’s the link to the question: here
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
for(int i=0;i<t;i++){
int n,sum,first,last;
cin>>n;
first=n%10;
n=n/10;
while(n>0){
if(n<10){
last=n;
n = n/10;
}
else{
n = n/10;
}
}
sum = first + last;
cout<<sum<<endl;
}
return 0;
}