what is wrong in my code I want to get the output of Problem:"Reverse The Number" of Beginner section

Here is my code:-
using namespace std;
int main()
{
int T=0;
int N=0;
int temp=0;
cin>>T;
int rev=0;
{
do
{
cin>>N;
do{
temp=N%10;
rev=(rev*10)+temp;
N/=10;
}while(N>0);
T-=1;
}while(T>0);
}
cout<<rev<<endl;
return 0;
}

You need to change two lines initialize rev=0 inside test case loop everytime and print rev inside test case loop
#include<bits/stdc++.h>
using namespace std; int main() { int T=0; int N=0; int temp=0; cin>>T; int rev=0; { do { rev=0; cin>>N; do{ temp=N%10; rev=(rev*10)+temp; N/=10; }while(N>0); T-=1; cout<<rev<<endl;}while(T>0); } return 0; }

Corrected solution: https://www.codechef.com/viewsolution/18642097

BTW, I could not find your submission… How did you know the verdict would be WA?

In fact it gives CE. But if you possess multiple accounts, do deactivate the other ones because multiple accounts are not allowed in Codechef.

Hey I am not having mutiple accounts…
Actually I was trying the Problem in code:Blocks

Hey I seen ur code and codechef is submitting this (your code) as correct Answer but as i run this code on code::blocks it showing different output (different to the one given in codechef Example).

To verify the same thing I use an online compiler website which is “https://www.onlinegdb.com/online_c++_compiler”.But output for me came out to be same.So once you also try and attach the image of output if Possible.

@bk54: You are describing something weird… The same code should always produce the same output for the same input.

alt text

I think this will help.

No compilers do produce weird ouputs sometimes… I have an experience of code blocks… It gave output of
pow(5,2) as 24
pow(5,3) as 124
pow(5,4) as 624
don’t know why

@sarthakmanna just Look @ the output EXAMPLE codechef has given:

@l_returns: Wow, I didn’t know that. Hopefully this problem is non existent in other languages.

@bk54: I can’t find anything wrong.

@sarthakmanna It’s not about language… It’s about codeblocks… I had an code which produced very weird out file while the same produced correct output file in gcc in ubuntu…
This may sound rubbish… as it did to me when I experienced that but its reality about code blocks