Divisor sum

Given an integer n, calculate the sum of all possible proper divisors of n.

Proper divisor of a natural number, is the divisor that is strictly less than the number.

Note : You have to return the sum.

Input Format : Integer n.

Output Format : Integer answer

Sample Input 1 :
20
Sample Output 1 :
22
Sample Input 2 :
10
Sample Output 2 :
8
Sample Output 1 Explanation :
20 has 5 proper divisors: 1, 2, 4, 5, 10, and the divisor summation is: 1 + 2 + 4 + 5 + 10 = 22

Comments

Popular posts from this blog

How to pass parameters in webhook?

Access and modify all the resources of our Wiki.js using WikiJS API

Fahrenheit to Celsius