gauchでやったもらい物
忘れないようにここにおいておく。
一つめ
(define (fizz-buzz) (let loop ((i 1)) (cond ((= (remainder i 15) 0) (print "FizzBuzz")) ((= (remainder i 3) 0) (print "Fizz")) ((= (remainder i 5) 0) (print "Buzz")) (#t (print i)) ) (if (< i 100) (loop (+ i 1)) ))) (fizz-buzz)
二つめ
(define (multi? a b) (= (remainder a b) 0) ) (define (fizz-buzz) (let loop ((i 1)) (print (if (multi? i 3) (if (multi? i 5) "FizzBuzz" "Fizz") (if (multi? i 5) "Buzz" i) )) (if (< i 100) (loop (+ i 1))) )) (fizz-buzz)