Modcal.lisp
1: (defvar a)
2: (defvar b)
3: (defvar c)
4: (defvar d)
5: (write-line " Enter two numbers in binary format with prefix #b : ")
6: (setf a(read))
7: (setf b(read))
8: (sb-thread:make-thread(lambda()(progn(sleep 0)
9: (setf c(+ a b))
10: (print "ADDITION in binary: ")
11: (format t " ~b" c )
12: (print "ADDITION in decimal: ")
13: (print c))))
14: (sb-thread:make-thread(lambda()(progn(sleep 0)
15: (setf c(- a b))
16: (print "SUBTRACTION in binary: ")
17: (format t " ~b" c )
18: (print "SUBTRACTION in decimal: ")
19: (print c))))
20: (sb-thread:make-thread(lambda()(progn(sleep 0)
21: (setf c(* a b))
22: (print "MULTIPLICATION in binary: ")
23: (format t " ~b" c )
24: (print "MULTIPLICATION IN DECIMAL: ")
25: (print c))))
26: (sb-thread:make-thread(lambda()(progn(sleep 0)
27: (setf c(* a a))
28: (print "SQUARE in binary: ")
29: (format t " ~b" c )
30: (print "SQUARE OF 1st NUMBER : ")
31: (print c))))
32: (sb-thread:make-thread(lambda()(progn(sleep 0)
33: (setf c(* b b b))
34: (print "CUBE OF 2ND NUMBER : ")
35: (print c))))
36: (sb-thread:make-thread(lambda()(progn(sleep 0)
37: (setf c(sin a))
38: (print "SINE OF 1ST NUMBER : ")
39: (print c))))
40: (sb-thread:make-thread(lambda()(progn(sleep 0)
41: (setf c(tan a))
42: (print "TAN OF 1ST NUMBER : ")
43: (print c))))
44: (sb-thread:make-thread(lambda()(progn(sleep 0)
45: (setf c(cos a))
46: (print "COSINE OF 1ST NUMBER : ")
47: (print c))))
48: (sb-thread:make-thread(lambda()(progn(sleep 0)
49: (setf c(min a b))
50: (print "MINIMUM NUMBER : ")
51: (print c))))
52: (sb-thread:make-thread(lambda()(progn(sleep 0)
53: (setf c(max a b))
54: (print "MAXIMUM NUMBER : ")
55: (print c))))
56: (exit)
57: /********************output*****************************/
58: student@student-OptiPlex-390:~/Desktop$ sbcl
59: This is SBCL 1.1.14.debian, an implementation of ANSI Common Lisp.
60: More information about SBCL is available at <http://www.sbcl.org/>.
61: SBCL is free software, provided as is, with absolutely no warranty.
62: It is mostly in the public domain; some portions are provided under
63: BSD-style licenses. See the CREDITS and COPYING files in the
64: distribution for more information.
65: * (load "Modcal.lisp")
66: Enter two numbers in binary format with prefix #b :
67: 11110
68: 111100
69: "ADDITION in binary: " 11101110101100010
70: "ADDITION in decimal: "
71: 122210
72: "SUBTRACTION in binary: " -11000011010010110
73: "SUBTRACTION in decimal: "
74: -99990
75: "MULTIPLICATION in binary: " 1001001100100100011111001101000
76: "MULTIPLICATION IN DECIMAL: "
77: 1234321000
78: "SQUARE in binary: " 111010110110110110010100100
79: "SQUARE OF 1st NUMBER : "
80: 123432100
81: "CUBE OF 2ND NUMBER : "
82: 1371330631000000
83: "SINE OF 1ST NUMBER : "
84: 0.97076005
85: "TAN OF 1ST NUMBER : "
86: 4.043957
87: "COSINE OF 1ST NUMBER : "
88: 0.240052
89: "MINIMUM NUMBER : "
90: 11110
91: "MAXIMUM NUMBER : "
92: 111100
Tags:
PROGRAMMING