Smallest number whose square has N digits | Java program for above approach ; Function to return smallest number whose square has N digits ; Calculate N - th term of the series ; Driver code
class GFG { static int smallestNum ( int N ) { float x = ( float ) ( Math . pow ( 10 , ( N - 1 ) / 2.0 ) ) ; return ( int ) ( Math . ceil ( x ) ) ; } public static void main ( String [ ] args ) { int N = 4 ; System . out . print ( smallestNum ( N ) ) ; } }