reverse of number,,,what is error in this code,,,,,my ide is showing me true answer for this code but codechef ide does not

#include
using namespace std;
int main(){
int t;
cin>>t;
while(t–){
int n,y;
cin>>n;
while(n>0){
y=n%10;
cout<<y;
n=n/10;
}cout<<endl;

	}
}

Check your code for input of 900…

It should print 9, not 009.

1 Like

but why ?reverse of 900 is 009 .

Leading zeroes are not allowed in that question. Though the problem statement doesnt make it very clear.

1 Like