Find the Largest N digit perfect square number in Base B | C ++ implementation to find Largest N digit perfect square number in Base B ; Function to find the largest N digit number ; Largest n - digit perfect square ; Print the result ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void nDigitPerfectSquares ( int n , int b ) { int largest = pow ( ceil ( sqrt ( pow ( b , n ) ) ) - 1 , 2 ) ; cout << largest ; } int main ( ) { int N = 1 , B = 8 ; nDigitPerfectSquares ( N , B ) ; return 0 ; }