Codechef isn't accepting the following code. Can anyone tell me what's wrong in it as I'm unable to point any mistake ?
//This program reverses a given integer.
#include<stdio.h>
int main(void)
{
int t,n,l;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
while(n>0){
l=n%10;
n=n/10;
printf("%d",l);
}
printf("\n");
}
return 0;
}
t
is no. of test cases.
n
is the input integer.
l
is some random variable to get the print job done.
This program is supposed to reverse a positive integer only.
Example:- Input - 1234
Output - 4321