Check if a given number N has at least one odd divisor not exceeding N | package whatever do not write package name here ; Function to check whether N has at least one odd divisor not exceeding N - 1 or not ; Stores the value of N ; Reduce the given number N by dividing it by 2 ; If N is divisible by an odd divisor i ; Check if N is an odd divisor after reducing N by dividing it by 2 ; Otherwise ; Driver Code ; Function Call
import java . io . * ; class GFG { public static String oddDivisor ( int N ) { int X = N ; while ( N % 2 == 0 ) { N /= 2 ; } for ( int i = 3 ; i * i <= X ; i += 2 ) { if ( N % i == 0 ) { return " Yes " ; } } if ( N != X ) { return " Yes " ; } return " No " ; } public static void main ( String [ ] args ) { int N = 10 ; System . out . println ( oddDivisor ( N ) ) ; } }