Getting WA on Reverse the number

What's wrong with this code? https://pastebin.com/giKgpvQn

this code is correct (in c language)
#include <stdio.h>

int main(void)
{
int T;
scanf("%d",&T);
while(T–)
{
long long int n,r,rev_n=0;
scanf("%lld",&n);
while(n!=0)
{
r=n%10;
rev_n = rev_n*10 + r;
n=n/10;
}
printf("%lld\n",rev_n);
}

}

1 Like

your code doesnot print the reverse of a number and u have not closed int main() see properly .
hope u will get what i am trying to say.

Because you’re using return 0 statement inside the test case while loop…So after reading one data and print it and goes to return…No further query is happening.

1 Like

if the return 0; will be otside while(t–), then it will not affect it and he is also missing } at last .
please verify .

1 Like