text: Sunny Number | Function check whether x is a perfect square or not ; Find floating point value of square root of x . ; If square root is an integer ; Function to check Sunny Number ; Check if ( N + 1 ) is a perfect square or not ; If ( N + 1 ) is not a perfect square ; Given Number ; Function call
code: function isPerfectSquare ( x ) { var sr = Math . sqrt ( x ) ; return ( ( sr - Math . floor ( sr ) ) == 0 ) ; } function checkSunnyNumber ( N ) { if ( isPerfectSquare ( N + 1 ) ) { document . write ( " " ) ; } else { document . write ( " " ) ; } } var N = 8 ; checkSunnyNumber ( N ) ;