GlobalLogic interview question

They asked me to write a program to reverse a given number