Accenture Coding Question | Sum Of Divisor | CodeWindow

Sum of divisors

Print the sum of the divisors of the integer number N.

Input specification:
Input 1: The integer ‘n’.

Output Specification:
Return the sum of divisors of ‘n’.

Example 1:
Input 1: 6

Output: 12
Explanation:
Divisors of 6 are 1,2,3,6. Sum of number (1+2+3+6)=12

Example 2:
Input 1: 36

Output: 91
Explanation:
Divisors of 36 are 1,2,3,4,6,9,12,18,36. Sum of number (1+2+3+4+6+9+12+18+36)=12

Solution in Python 3:

Solution in C++ :

Solution in C :

Solution in JAVA :

Output:

Recent Posts
Pages