Welcome to W3Courses
 Like Us on Facebook

Even

Check if Even or Odd using Scheme Source Code

The following code checks if a number is Even or Odd

CODE
(define (even? n)
      (if (eqv? n 0) #t
             (odd? (- n 1))))
(define (odd? n)
      (if (eqv? n 0) #f
             (even? (- n 1))))

Share