id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

sumFactors


Given a positive integer n, compute the sum of all the divisors of n. For example, if n were 12, you'd return 28 since that is the sum 1 + 2 + 3 + 4 + 6 + 12.


sumFactors(12) → 28
sumFactors(6) → 12
sumFactors(28) → 56

...Save, Compile, Run (ctrl-enter)

public int sumFactors(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy