#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;
}
}
#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.
but why ?reverse of 900 is 009 .
Leading zeroes are not allowed in that question. Though the problem statement doesnt make it very clear.