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

 

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

Write a method that accepts two integers 'a' and 'b' then returns the "funny sum" of those integers. The "funny sum" is a+b+(half b)+(half half b)+(half half half b)+... stopping before you get to 1. Note that (half b) refers to b div 2 and (half half b) refers to (b div 2) div 2.


quizSLAPHL_P2(4291, 8) → 4305
quizSLAPHL_P2(28, 22) → 68
quizSLAPHL_P2(248, 2142) → 4525

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

public int quizSLAPHL_P2(int a, int b) { }

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

Copyright Nick Parlante 2017 - privacy