Nth non | function to find the nth Non - Square Number ; conversion from int to long double is necessary in order to preserve decimal places after square root . ; calculating the result ; initializing the term number ; Print the result
< ? php function findNthNonSquare ( $ n ) { $ x = $ n ; $ ans = $ x + floor ( 0.5 + sqrt ( $ x ) ) ; return ( int ) $ ans ; } $ n = 16 ; echo " The ▁ " . $ n . " th ▁ Non - Square ▁ number ▁ is ▁ " ; echo findNthNonSquare ( $ n ) ;