Last active
November 2, 2019 05:25
-
-
Save chelseatroy/94d040862d6fb7b6bd9f79a87ad25259 to your computer and use it in GitHub Desktop.
Function Definitions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (find-smallest a b c) | |
(cond ((and (<= a b) (<= a c) a)) | |
((and (<= b c) (<= b c) b)) | |
((and (<= c a) (<= c b) c)) | |
) | |
) | |
(define (largest-squared-hypotenuse a b c) ( | |
cond ((= (find-smallest a b c) a) (+ (* b b) (* c c))) | |
((= (find-smallest a b c) b) (+ (* a a) (* c c))) | |
((= (find-smallest a b c) c) (+ (* b b) (* a a))) | |
) | |
) | |
(largest-squared-hypotenuse 1 2 3) ;--> 13 (3 squared plus 2 squared) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment