Count number of 1 s in the array after N moves | C # implementation of the above approach ; Function to count number of perfect squares ; Counting number of perfect squares between a and b ; Function to count number of 1 s in array after N moves ; Driver Code ; Initialize array size ; Initialize all elements to 0
using System ; class GFG { static double perfectSquares ( int a , int b ) { return ( Math . Floor ( Math . Sqrt ( b ) ) - Math . Ceiling ( Math . Sqrt ( a ) ) + 1 ) ; } static double countOnes ( int [ ] arr , int n ) { return perfectSquares ( 1 , n ) ; } static public void Main ( ) { int N = 10 ; int [ ] arr = { 0 } ; Console . WriteLine ( countOnes ( arr , N ) ) ; } }