Nth non | Function to find the nth Non - Square Number ; Conversion from var to var var is necessary in order to preserve decimal places after square root . ; Calculating the result ; Initializing the term number ; Print the result
function findNthNonSquare ( n ) { var x = n ; var ans = x + Math . floor ( 0.5 + Math . sqrt ( x ) ) ; return parseInt ( ans ) ; } var n = 16 ; document . write ( " " + n + " " ) ; document . write ( findNthNonSquare ( n ) ) ;