Smallest N digit number divisible by N | C ++ program for the above approach ; Function to find the smallest N - digit number divisible by N ; Return the smallest N - digit number calculated using above formula ; Driver Code ; Given N ; Function Call
#include <iostream> NEW_LINE #include <math.h> NEW_LINE using namespace std ; int smallestNumber ( int N ) { return N * ceil ( pow ( 10 , ( N - 1 ) ) / N ) ; } int main ( ) { int N = 2 ; cout << smallestNumber ( N ) ; return 0 ; }