Traverse all digits from right to left and check if any digit is smaller than previous .
while ( num ) { int rem = num % 10 ; num /= 10 ; if ( rem > prev ) return false ; prev = rem ; } return true ; }