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

 

jebbert@volusia.k12.fl.us > sept7_2018_SLHL_sumFactors
prev  |  next  |  chance

Write a method that returns the sum of all the prime factors of the input parameter. Prime numbers are: 2, 3, 5, 7, 11, etc. These numbers only have whole number factors of themselves and 1. For example, 5 only has factors of 1 and 5, so 5 is prime. The input parameter will be an integer that is greater than or equal to 2. This is not as difficult as it may seem. Think first! Use paper and pencil to model with some of the test data!


sept7_2018_SLHL_sumFactors(1542451) → 1542451
sept7_2018_SLHL_sumFactors(2) → 2
sept7_2018_SLHL_sumFactors(18) → 8

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

public int sept7_2018_SLHL_sumFactors(int num) { }

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: 290

Copyright Nick Parlante 2017 - privacy