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

 

multiplyRecursive


Using the following mathematical fact, a * b = a * (b - 1) + a define a recursive function that when passed two integers, returns their product without using the * operator or any loops.


multiplyRecursive(10, 500) → 5000
multiplyRecursive(-19, 2) → -38
multiplyRecursive(10, -5000) → -50000

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

int multiplyRecursive(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: 3 Post-solution available

Copyright Nick Parlante 2017 - privacy