Count numbers upto N which are both perfect square and perfect cube | C # implementation of the above approach ; Function to return required count ; Driver Code ; function call to print required answer
using System ; public class GFG { static int SquareCube ( long N ) { int cnt = 0 , i = 1 ; while ( ( int ) ( Math . Pow ( i , 6 ) ) <= N ) { ++ cnt ; ++ i ; } return cnt ; } public static void Main ( ) { long N = 100000 ; Console . WriteLine ( SquareCube ( N ) ) ; } }