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
Program Notes
- This program was created by, Bruce Maxim, during lecture 13, while explaining Lisp commands
- Then tested and run using the XLISP-STAT Unix compiler Release 2. Copyright(c)1989-1999, by Luke Tierney.
Last modified: 2:40 AM on 11/16/1999 by Christopher Williams