Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (setf gpa 0
- total-credit-hours 0)
- (format t "This program will calculate your GPA.~%Enter zero for credit hours to stop entering new courses~%")
- (loop while t do
- (format t "~%New Course~%Credit hours: ")
- (setf credit-hours (read))
- (if (zerop credit-hours)
- (progn
- (format t "~%Done entering courses~%")
- (return))
- (progn
- (format t "Grade points: ")
- (setf grade-points (read))))
- (setf gpa (+ gpa (* credit-hours grade-points)))
- (setf total-credit-hours (+ total-credit-hours credit-hours))
- )
- (setf gpa (/ gpa total-credit-hours))
- (format t "~%Your GPA: ~$~%" gpa)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement