August 19, 2024
P32 - Determine the greatest common divisor of two positive integer numbers
Use Euclid's algorithm.
Example:* (gcd 36 63)9
lisp
;;; Retorna o maximo divisor comum
(defun my-gcd (m n)
(if (= n 0)
m
(my-gcd n (mod m n))
)
)
August 19, 2024
Use Euclid's algorithm.
Example:* (gcd 36 63)9
lisp
;;; Retorna o maximo divisor comum
(defun my-gcd (m n)
(if (= n 0)
m
(my-gcd n (mod m n))
)
)
Don't have an account? We will create one for you.
Enter the OTP send to
in seconds. Check your spam folder if you can't find email from us.
Valid email is required for further communications