Arithmetic/Integer: Difference between revisions
Content added Content deleted
Line 3,401: | Line 3,401: | ||
prn "remainder: " a%b |
prn "remainder: " a%b |
||
prn "exponent: " a^b</lang> |
prn "exponent: " a^b</lang> |
||
=={{header|XLISP}}== |
|||
<lang xlisp>(DEFUN INTEGER-ARITHMETIC () |
|||
(DISPLAY "Enter two integers separated by a space.") |
|||
(NEWLINE) |
|||
(DISPLAY "> ") |
|||
(DEFINE A (READ)) |
|||
(DEFINE B (READ)) |
|||
(DISPLAY `(SUM ,(+ A B))) |
|||
(NEWLINE) |
|||
(DISPLAY `(DIFFERENCE ,(- A B))) |
|||
(NEWLINE) |
|||
(DISPLAY `(PRODUCT ,(* A B))) |
|||
(NEWLINE) |
|||
(DISPLAY `(QUOTIENT ,(QUOTIENT A B))) ; truncates towards zero |
|||
(NEWLINE) |
|||
(DISPLAY `(REMAINDER ,(REM A B))) ; takes sign of first operand |
|||
(NEWLINE) |
|||
(DISPLAY `(EXPONENTIATION ,(EXPT A B))))</lang> |
|||
=={{header|XPL0}}== |
=={{header|XPL0}}== |