; File: pythagora.scm ; Student: Jaclyn Siegelski ; Title: Pythagorean Theorem: a^2 + b^2 = c^2 ; Run: (start) ; Pythagorean Theorem says a^2 + b^2 = c^2 ; Enter side a? 3 ; Enter side b? 4 ; The length of the hypotenuse c is 5 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define (start) (let ((a 0)(b 0)(c 0)) ; local variables (display "Pythagorean Theorem says a^2 + b^2 = c^2 \n") (display "Enter the side a?: ")(set! a(read)) (display "Enter the side b?: ")(set! b(read)) (set! c (sqrt(+ (* a a) (* b b)))) (display a) (display "^2 + ")(display b) (display "^2 = c^2\n") (display "The length of the hypotenuse c is ")(display c) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;using functions ;Author: Mihaela Malita (define (start1) (display "Pythagorean Theorem says a^2 + b^2 = c^2 \n") (let ((a (input 'a))(b (input 'b))) (display "The length of the hypotenuse c is ") (display (hypotenuse a b)) ) ) (define (input sidename) (display "Enter side ") (display sidename) (display " ?: ") (read) ) (define (hypotenuse a b) ; compute hypotenuse c (sqrt (+ (* a a) (* b b))) ; Pythagoras' theorem )