Find N digits number which is divisible by D | Java program to Find N digits number which is divisible by D ; Function to return N digits number which is divisible by D ; to store answer ; Driver code
import java . io . * ; class GFG { static String findNumber ( int n , int d ) { String ans = " " ; if ( d != 10 ) { ans += Integer . toString ( d ) ; for ( int i = 1 ; i < n ; i ++ ) ans += '0' ; } else { if ( n == 1 ) ans += " Impossible " ; else { ans += '1' ; for ( int i = 1 ; i < n ; i ++ ) ans += '0' ; } } return ans ; } public static void main ( String [ ] args ) { int n = 12 , d = 3 ; System . out . println ( findNumber ( n , d ) ) ; } }