SHARE
TWEET

Untitled

a guest Dec 30th, 2009 148 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (setf gpa 0
  2.      total-credit-hours 0)
  3.  
  4. (format t "This program will calculate your GPA.~%Enter zero for credit hours to stop entering new courses~%")
  5.  
  6. (loop while t do
  7.      (format t "~%New Course~%Credit hours: ")
  8.      (setf credit-hours (read))
  9.      (if (zerop credit-hours)
  10.      (progn
  11.        (format t "~%Done entering courses~%")
  12.        (return))  
  13.    (progn
  14.      (format t "Grade points: ")
  15.      (setf grade-points (read))))
  16.      (setf gpa (+ gpa (* credit-hours grade-points)))
  17.      (setf total-credit-hours (+ total-credit-hours credit-hours))
  18.      )
  19.  
  20. (setf gpa (/ gpa total-credit-hours))
  21.  
  22. (format t "~%Your GPA: ~$~%" gpa)
RAW Paste Data
Top