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