Tell me whats wrong in my code

#include
using namespace std;

int main() {int t;
cin>>t;
for(int i=0;i<t;i++)
{ int a,n;
cin>>a;
n=a%10;
while(a>10)
{a=a/10;
}
cout<<a+n<<“\n”;
}// your code goes here
return 0;
}

what is wrong in my code.the online ide is showing me correct output but WA
problem-FLOW004 Problem - CodeChef

CHECK THIS ONE YOU CAN USE THIS…

#include <bits/stdc++.h>
using namespace std;

int main() {
long int t;
cin>>t;
for(int i=0;i<t;i++)
{
string s;
cin>>s;
long int x=s.length(),sub=(int)‘0’;
long int a=((int)s[0]-sub)+((int)s[x-1]-sub);
cout<<a<<endl;

}

return 0;
}

Hi… Your code gives WA for input like 10,100…
(i.e. intput is like 10xxxx where x are other digits)
To avoid this use while(a>=10)