My answers are always showing as wrong.

Whenever i type a code i execute it and only f it works i submit. But every time i submit it shows as wrong answer but a similar answer with same logic but with different variable names and function names are accepted. Can someone explain why it is so?

#include <stdio.h>
int main()
{
 int n, reversedInteger = 0, rem, originalInteger,times;
scanf("%d",&times);
while(times--)
{


scanf("%d", &n);

originalInteger = n;

// reversed integer is stored in variable 
while( n!=0 )
{
    rem = n%10;
    reversedInteger = reversedInteger*10 + rem;
    n /= 10;
}

// palindrome if orignalInteger and reversedInteger are equal
if (originalInteger == reversedInteger)
    printf("wins\n");
else
    printf("losses\n");
}    

return 0;
 }

This is my code for The block game problem. Why is it wrong? I saw a similar answer which was accepted!

There is a silly mistake in your code, you have to make reversedInteger=0 in all the test cases meaning at the beginning of while loop. I edited that and got accepted, I bet you did such a mistake all the times because it doesn’t matter what you name a variable Edited code - CodeChef: Practical coding for everyone

Hey! i dont understand how its a mistake first of all. I executed it outside codechef i got the expected output. Even by declaring reversedinteger=0 in the beginning is applicable for all test cases right?

You see consider multiple test cases like
2
123 567

After the first test case reversed integer is 321 it remains 321 and you execute for second test case so it would become 321765 you can check this by printing reverse integer at the end of each test case so it would not give the expected answer as the reversed integer made by your code is wrong