Geeksforgeeks

Timer is Running

Given a number **N**. Print the minimum positive integer by which it should be divided so that the result is an odd number.

**Example 1:**

Input:N = 36Output:4Explanation:36 must be divided by 4 or 12 to make it odd. We take minimum of 4 and 12 i.e. 4.

**Example 2:**

Input:N = 5Output:1Explanation:5 is already odd.

**Your Task: **

You don't need to read input or print anything. Your task is to complete the function **makeNumberOdd()** which takes an integer N as an input parameter and return the minimum positive integer by which it should be divided so that the result is an odd number.

**Expected Time Complexity:** O(LogN)

**Expected Auxiliary Space:** O(1)

**Constraints:**

1 <= N <= 100000

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

jainshubham52535 | 529 |

Pathak1899 | 436 |

yashdip123 | 380 |

kirtidee18 | 377 |

jots62 | 351 |

kirtidee18 | 1057 |

ykaushik | 752 |

aggarwalvatsal5 | 741 |

harbilassingh | 576 |

pmr_3689 | 570 |

blackshadows | 5456 |

Ibrahim Nash | 5450 |

akhayrutdinov | 5111 |

mb1973 | 4976 |

Quandray | 4827 |

Login to report an issue on this page.