LISP program to find the area of a circle using a function
gd.lisp
(write-line"———————————————————————————————————————————")(write-line"Program to find the area of a circle")(write-line"———————————————————————————————————————————")(princ"Enter the radius ")(setqr(read))(defconstantPI3.1416)(defunArea()(setqA(*PIrr))(terpri)(princ"The area of a circle is ")(writeA)(setqC(*6.2831r))(terpri)(princ"The circumference of a circle is ")(writeC))(Area)(terpri)(formatt"———————————————————————————————————————————")
Output
godarda@gd:~$ clisp gd.lisp
———————————————————————————————————————————
Program to find the area of a circle
———————————————————————————————————————————
Enter the radius 10
The area of a circle is 314.15997
The circumference of a circle is 62.831
———————————————————————————————————————————
godarda@gd:~$
Comments and Reactions
Thank You
Dear User, Thank you for visitng GoDarda. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.