text: Nth non | C # program to find n - th non - square number . ; 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 ; Driver code ; initializing the term number ; Print the result
code: using System ; class GFG { static int findNthNonSquare ( int n ) { double x = ( double ) n ; double ans = x + Math . Floor ( 0.5 + Math . Sqrt ( x ) ) ; return ( int ) ans ; } public static void Main ( ) { int n = 16 ; Console . Write ( " The ▁ " + n + " th ▁ Non - Square ▁ " + " number ▁ is ▁ " ) ; Console . Write ( findNthNonSquare ( n ) ) ; } }