Jump to content

Arithmetic/Integer: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 81:
lv_result = p_first mod p_second.
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}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.