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

 

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

Write a method called factSum that return the sum of the digits of the factorial of the positive integer input parameter. Recall that the factorial of a number is the product of all the positive integers less than or equal to that number. For example, 4! (four factorial) means 1*2*3*4 which equals 24. So factSum(4) returns 6 because the sum of the digits of 24 is 6. Factorials get very large very fast. Your program needs to work for factorials that are less than the largest long integer. The sum should be returned as an integer as the sum will be much less than the actual factorial.


factSum(1) → 1
factSum(2) → 2
factSum(3) → 6

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

public int factSum(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