Count of perfect squares of given length | C # Program to count perfect squares of given length ; Function to return the count of n digit perfect squares ; Driver code
using System ; class GFG { static int countSquares ( int n ) { int r = ( int ) Math . Ceiling ( Math . Sqrt ( Math . Pow ( 10 , n ) ) ) ; int l = ( int ) Math . Ceiling ( Math . Sqrt ( Math . Pow ( 10 , n - 1 ) ) ) ; return r - l ; } public static void Main ( ) { int n = 3 ; Console . Write ( countSquares ( n ) ) ; } }