LISP program to demonstrate the use of trigonometric functions
kw.lisp
(write-line "———————————————————————————————————————————") (write-line "Program for trigonometric functions") (write-line "———————————————————————————————————————————") (princ "Enter the angle ") (setq a(read)) (format t "~% sin(~d) | ~d"a (sin a)) (format t "~% cos(~d) | ~d"a (cos a)) (format t "~% tan(~d) | ~d"a (tan a)) (format t "~% cot(~d) | ~d"a (/ (cos 45) (sin 45))) (format t "~% sec(~d) | ~d"a (/ 1 (cos 45))) (format t "~%cosec(~d) | ~d"a (/ 1 (sin 45))) (terpri)(format t "———————————————————————————————————————————")
Output
kodingwindow@kw:~$ clisp kw.lisp ——————————————————————————————————————————— Program for trigonometric functions ——————————————————————————————————————————— Enter the angle 60 sin(60) | -0.3048106 cos(60) | -0.95241296 tan(60) | 0.32004037 cot(60) | 0.6173696 sec(60) | 1.9035945 cosec(60) | 1.1752213 ——————————————————————————————————————————— kodingwindow@kw:~$
Comments and Reactions
What Next?
LISP program to demonstrate the use of numeric conversion functions
LISP program to calculate the square and cube of numbers
LISP program to find the min and max of two numbers
Advertisement