about | help | code help+videos | done | prefs |
Write a method that accepts an integer input parameter. The method then returns the sum of all the quotients and remainders of all the divisions from 2 up to but not including the input parameter. For exmaple, quizSLAPHL_P3(8) returns 19 since 8/2=4R0, 8/3=2R2, 8/4=2R0, 8/5=1R3, 8/6=1R2, and 8/7=1R1. Adding up all the quotients yields 4+2+2+1+1+1=11. Adding up all the remainders yields 0+2+0+3+2+1=8. 11+8=19. Hence the result is 19. quizSLAPHL_P3(4) → 4 quizSLAPHL_P3(5) → 8 quizSLAPHL_P3(6) → 10 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 299
Copyright Nick Parlante 2017 - privacy