Check if a given number N has at least one odd divisor not exceeding N – 1

Check if a given number N has at least one odd divisor not exceeding N – 1
Given a positive integer N, the task is to check if the given number N has at least 1 odd divisor from the range [2, N – 1] or not. If found to be true, then print “Yes”. Otherwise, print “No”.
Examples:

Input: N = 10Output: YesExplanation:10 has 5 as the odd divisor. Therefore, print Yes.
Input: N = 8Output: No

Approach: The idea to solve the given problem is to iterate through all possible odd divisors over the range [3, sqrt(N)] and if there exists any such divisor, then print “Yes”. Otherwise, print “No”.Below is the implementation of the above approach:

C++

#include
using namespace std;
  

string oddDivisor(int N)
{
    
    int X = N;
  
    
    
    while (N % 2 == 0) {
        N /= 2;
    }
  
    for (int i = 3; i * i