Arithmetic/Integer: Difference between revisions

Content added Content deleted
(Modula-3)
(m4)
Line 284: Line 284:
" A/B=" ,t 2dup / , nl \
" A/B=" ,t 2dup / , nl \
" A%B=" ,t % , nl
" A%B=" ,t % , nl

=={{header|M4}}==

Because of the particular nature of M4, the only user-input is the code itself. Anyway the following code can be used:
<lang m4>eval(A+B)
eval(A-B)
eval(A*B)
eval(A/B)
eval(A%B)</lang>

once saved in a file, e.g. <tt>operations.m4</tt>:

<pre>m4 -DA=4 -DB=6 operations.m4</pre>

or using a sort of ''driver'':

<lang m4>define(`A', 4)dnl
define(`B', 6)dnl
include(`operations.m4')</lang>



=={{header|MAXScript}}==
=={{header|MAXScript}}==