Arithmetic/Integer: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 81: | Line 81: | ||
lv_result = p_first mod p_second. |
lv_result = p_first mod p_second. |
||
write: / 'Remainder:', lv_result.</lang> |
write: / 'Remainder:', lv_result.</lang> |
||
=={{header|ACL2}}== |
|||
<lang Lisp> |
|||
:set-state-ok t |
|||
(defun get-two-nums (state) |
|||
(mv-let (_ a state) |
|||
(read-object *standard-oi* state) |
|||
(declare (ignore _)) |
|||
(mv-let (_ b state) |
|||
(read-object *standard-oi* state) |
|||
(declare (ignore _)) |
|||
(mv a b state)))) |
|||
(defun integer-arithmetic (state) |
|||
(mv-let (a b state) |
|||
(get-two-nums state) |
|||
(mv state |
|||
(progn$ (cw "Sum: ~x0~%" (+ a b)) |
|||
(cw "Difference: ~x0~%" (- a b)) |
|||
(cw "Product: ~x0~%" (* a b)) |
|||
(cw "Quotient: ~x0~%" (floor a b)) |
|||
(cw "Remainder: ~x0~%" (mod a b))))))</lang> |
|||
=={{header|Ada}}== |
=={{header|Ada}}== |