Generate an alternate odd | C ++ Program to implement the above approach ; Function to print the required sequence ; Print ith odd number ; Driver Code
#include <iostream> NEW_LINE using namespace std ; void findNumbers ( int n ) { int i = 0 ; while ( i <= n ) { cout << 2 * i * i + 4 * i + 1 + i % 2 << " ▁ " ; i ++ ; } } int main ( ) { int n = 6 ; findNumbers ( n ) ; }