LISP program to find the area of a circle using a function
codeaft.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
codeaft@codeaft:~$ clisp codeaft.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
———————————————————————————————————————————
codeaft@codeaft:~$
Comments and Reactions
Thank You
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.