Advertisement
Guest User

LISP calc #1

a guest
Dec 29th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.48 KB | None | 0 0
  1. ; calculator function definition
  2. (defun calculator ()
  3. ; variable firnum as an input
  4. (princ "Enter the first number: ")
  5. (setq firnum (read))
  6. ; variable secnum as an input
  7. (princ "Enter the second number: ")
  8. (setq secnum (read))
  9. ; variable sumnum as a result of firnum + secnum
  10. (setq sumnum (+ firnum secnum))
  11. ; formated output with firnum and secnum as a text and sumnum as a decimal
  12. (format t "Sum of ~r and ~r is: ~D" firnum secnum sumnum))
  13. ; calculator function
  14. (calculator)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement