Smallest number whose square has N digits | C ++ Program to find the smallest number whose square has N digits ; Function to return smallest number whose square has N digits ; Calculate N - th term of the series ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int smallestNum ( int N ) { float x = pow ( 10.0 , ( N - 1 ) / 2.0 ) ; return ceil ( x ) ; } int main ( ) { int N = 4 ; cout << smallestNum ( N ) ; return 0 ; }