Generate an alternate odd | Java program to implement the above approach ; Function to print the required sequence ; Print ith odd number ; Driver code ; Function call
import java . util . * ; class GFG { static void findNumbers ( int n ) { int i = 0 ; while ( i <= n ) { System . out . print ( 2 * i * i + 4 * i + 1 + i % 2 + " ▁ " ) ; i ++ ; } } public static void main ( String [ ] args ) { int n = 6 ; findNumbers ( n ) ; } }