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

 

gcdRecursive


Solve https://codingbat.com/prob/p267908 before moving on to this problem. Define a recursive function that when passed two integers, returns their greatest common divisor. This time, you must also cater for negative numbers.


gcdRecursive(20, -100) → 20
gcdRecursive(-72, 48) → 24
gcdRecursive(100, -121) → 1

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

int gcdRecursive(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: 2 Post-solution available

Copyright Nick Parlante 2017 - privacy