Find elements in a given range having at least one odd divisor | C ++ program to print all numbers with least one odd factor in the given range ; Function to prints all numbers with at least one odd divisor ; Check if the number is not a power of two ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; int printOddFactorNumber ( int n , int m ) { for ( int i = n ; i <= m ; i ++ ) { if ( ( i > 0 ) && ( ( i & ( i - 1 ) ) != 0 ) ) cout << i << " ▁ " ; } } int main ( ) { int N = 2 , M = 10 ; printOddFactorNumber ( N , M ) ; return 0 ; }