Finds reverse of given num x .
static int reverseNum ( int x ) { string s = x . ToString ( ) ; string str = " " ; for ( int i = s . Length - 1 ; i >= 0 ; i -- ) { str = str + s [ i ] ; } int rev = Int32 . Parse ( str ) ; return rev ; } static bool isMysteryNumber ( int n ) { for ( int i = 1 ; i <= n / 2 ; i ++ ) {