Sum of the squares

Define a procedure solution that takes three numbers as arguments and returns the sum of the squares of the two larger numbers.


    # Artem Stepanenko
    11 months ago
    (define (square x) (* x x)) (define (sum_of_squares first second) (+ (square first) (square second)) ) (define (sum_of_squares_of_big a b c) (sum_of_squares (max a b c) (max (min a b) (min a c) (min b c)) ) )
Authentication required

You must log in to post a comment.

Login
(check-equal? (solution 1 2 3) 13)
(check-equal? (solution 4 2 3) 25)
(check-equal? (solution 0 0 0) 0)
(check-equal? (solution 1 0 1) 2)
(check-equal? (solution 2 3 0) 13)