Check if given number is perfect square | Javascript program for the above approach ; If ceil and floor are equal the number is a perfect square ; Driver Code
function checkperfectsquare ( n ) { if ( Math . ceil ( Math . sqrt ( n ) ) == Math . floor ( Math . sqrt ( n ) ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; } } let n = 49 ; checkperfectsquare ( n ) ;