Smallest N digit number divisible by N | Java 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
import java . util . * ; class GFG { static int smallestNumber ( int N ) { return ( int ) ( N * Math . ceil ( Math . pow ( 10 , ( N - 1 ) ) / N ) ) ; } public static void main ( String [ ] args ) { int N = 2 ; System . out . print ( smallestNumber ( N ) ) ; } }