Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // recursive greatest common devisor function
- int gcd(int a, int b){
- // assume x, y >= 1
- int max = Math.max(a, b);
- int min = Math.min(a, b);
- int remainder = max % min;
- if (remainder == 0) {
- return min;
- } else {
- return ggT(min, remainder);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement