Dsa
Math
Easy
Sum of All Divisors
You are tasked with calculating the sum of all divisors for a given integer n.
Input Format:
- A single integer n (1 ≤ n ≤ 10^6).
Output Format:
- A single integer which is the sum of all divisors of n.
Example:
Input:
6
Output:
12
(1 + 2 + 3 + 6)
Key concepts
divisorsmathcomputation
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