The Lisp Programming Language

Am I odd, or even?


Click below to go directly to a specific section:
Description | Source Code | Sample Run | Program Notes

Description

This program checks whether the numbers that the user inputs at the prompt are even or odd. This program displays Lisp's <if, else> clauses, and how they are implimented. 

Source Code


(defun CHECK (x y)
   (format t "Your two numbers are")
   (cond((and (evenp x)(evenp y)) 'both_odd)
        ((and (oddp x)(oddp y)) 'both_even)
        (T 'there_a_mixture)
   )
)


Sample Run

Convert


Program Notes


[Back][Home]

Last modified: 2:40 AM on 11/16/1999 by Christopher Williams