Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (square x) (* x x))
- (define (sum-of-squares a b) (+ (square a) (square b)))
- (define (sum-of-largest-squares x y z)
- (cond ((and (< x y) (< y z))) ((sum-of-squares y z))
- ((and (> x y) (< x z))) ((sum-of-squares x z))
- ((and (> x z) (< x y))) ((sum-of-squares x y))
- ))
- (sum-of-largest-squares 1 2 3)
- (sum-of-largest-squares 1 3 2)
- (sum-of-largest-squares 2 1 3)
- (sum-of-largest-squares 2 3 1)
- (sum-of-largest-squares 3 2 1)
- (sum-of-largest-squares 3 1 2)
- ;;; Output
- #|
- #t
- 13
- 10
- 10
- 5
- 5
- |#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement