First and Last Digit Question in the Beginner Section FLOW004

Hi everyone! I just attempted the problem given in the above link but even though the code works on my editor and I am pretty sure I have not exceeded any time limits of the program, CodeChef does not accept the following solution. Can someone help me out and tell me the reason why?

#include <stdio.h>

int main(void)

{

int t;

int n; int sum=0;int r;

scanf("%d", &t);

for(int i=0;i<t;i++)

{

    scanf("%d", &n);

    r = n%10;

    while(n>=10)

    {

        n=n/10;

    }

   

    printf("%d", r+n);

}

return 0;

}

It fails on the sample testcase:

3 
1234
124894
242323

Your output has to match the expected output exactly.