Check whether a given number N is a Nude Number or not | C ++ program to check if the number if Nude number or not ; Check if all digits of num divide num ; array to store all digits of the given number ; If any of the condition is true for any digit Then N is not a nude number ; Driver code
#include <iostream> NEW_LINE using namespace std ; bool checkDivisbility ( int num ) { int digit ; int N = num ; while ( num != 0 ) { digit = num % 10 ; num = num / 10 ; if ( digit == 0 N % digit != 0 ) return false ; } return true ; } int main ( ) { int N = 128 ; bool result = checkDivisbility ( N ) ; if ( result ) cout << " Yes " ; else cout << " No " ; return 0 ; }