Now traverse the number string to find and increment result whenever a digit divides N .
int result = 0 ; for ( int i = 0 ; i < N . length ( ) ; i ++ ) { if ( divide [ N [ i ] - '0' ] == true ) result ++ ; } return result ; }