Did you try out the actual test cases given and check that the output was an exact match for the expected output given? Because that doesn’t happen for your code above.
FLOW007, “Reverse The Number” has relatively friendly public test cases that exercise your code more fully. You will encounter plenty of challenges here where you have to anticipate edge cases that don’t occur in the given “worked” test set.
You have used variable rem before and you are reusing it again.It has already some value before entering the j loop. Just re-initialize rem = 0 before j loop .
The second and most important mistake is while(n1–) which doesn’t make any sense here. use while(n1!=0) , you will be good to go.