Find a N | CPP program to find N digit number such that it is not divisible by any of its digits ; Function that print the answer ; if n == 1 then it is not possible ; loop to n - 1 times ; print 4 as last digit of the number ; Driver code ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findTheNumber ( int n ) { if ( n == 1 ) { cout << " Impossible " << endl ; return ; } for ( int i = 0 ; i < n - 1 ; i ++ ) { cout << "5" ; } cout << "4" ; } int main ( ) { int n = 12 ; findTheNumber ( n ) ; return 0 ; }