Runtime error

#include <bits/stdc++.h>

using namespace std;

int main() {
int i,n,t,a,b;
cin>>n;
int x,y[10];
x=0;
for(i=0;i<n;i++)
{y[i]=0;
cin>>t;
a=t%10;
while(t!=0)
{
b=t%10;
t=t/10;
}
y[i]=a+b;
}
for(i=0;i<n;i++)
{
cout<<y[i]<<"\n";
}

return 0;}

I am getting runtime error in this when I submit but this code is running fine otherwise please help

What Problem are you trying to solve?

If Give an integer N . Write a program to obtain the sum of the first and last digits of this number.

What if n \gt 10 ? (Given that the number of test cases can go up to 1000).

1 Like

yes we can change 10 to 1000 in that case