Print all perfect squares from the given range | C # implementation of the approach ; Function to print all the perfect squares from the given range ; For every element from the range ; If current element is a perfect square ; Driver code
using System ; class GFG { static void perfectSquares ( int l , int r ) { for ( int i = l ; i <= r ; i ++ ) { if ( Math . Sqrt ( i ) == ( int ) Math . Sqrt ( i ) ) Console . Write ( i + " ▁ " ) ; } } public static void Main ( String [ ] args ) { int l = 2 , r = 24 ; perfectSquares ( l , r ) ; } }