Print all perfect squares from the given range | 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
function perfectSquares ( l , r ) { for ( let i = l ; i <= r ; i ++ ) { if ( Math . sqrt ( i ) == parseInt ( Math . sqrt ( i ) ) ) document . write ( i + " " ) ; } } let l = 2 ; let r = 24 ; perfectSquares ( l , r )