LISP program for the positive-negative test of a given number
kw.lisp
(write-line"———————————————————————————————————————————")(write-line"Program to check a number is +ve or -ve")(write-line"———————————————————————————————————————————")(princ"Enter the number ")(setqa(read))(if(=a0)(formatt"~%~d is neither +ve nor -ve "a))(if(>a0)(formatt"~%~d is +ve number "a))(if(<a0)(formatt"~%~d is -ve number "a))(terpri)(formatt"———————————————————————————————————————————")
Output
kodingwindow@kw:~$ clisp kw.lisp
———————————————————————————————————————————
Program to check a number is +ve or -ve
———————————————————————————————————————————
Enter the number -1
-1 is -ve number
———————————————————————————————————————————
kodingwindow@kw:~$ clisp kw.lisp
———————————————————————————————————————————
Program to check a number is +ve or -ve
———————————————————————————————————————————
Enter the number 0
0 is neither +ve nor -ve
———————————————————————————————————————————
kodingwindow@kw:~$
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.