Program to print non square numbers | Java program to print first n non - square numbers . ; Returns n - th non - square number . ; loop to print non squares below n ; Driver code
import java . io . * ; import java . math . * ; class GFG { static int nonsquare ( int n ) { return n + ( int ) ( 0.5 + ( Math . sqrt ( n ) ) ) ; } static void printNonSquare ( int n ) { for ( int i = 1 ; i <= n ; i ++ ) System . out . print ( nonsquare ( i ) + " ▁ " ) ; } public static void main ( String args [ ] ) { int n = 10 ; printNonSquare ( n ) ; } }