Dsa
Math
Easy
Sum of Odd Factors
Given a positive integer n, calculate the sum of all odd factors of n.
Input Format:
A single line containing the integer n (1 <= n <= 10^6).
Output Format:
A single line that contains the sum of all odd factors of n.
Example:
Input:
12
Output:
16
(1 + 3 + 3 + 4 = 16)
Key concepts
mathfactorsodd
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now