Arithmetic/Integer: Difference between revisions

Content added Content deleted
No edit summary
Line 1,070: Line 1,070:


end</lang>
end</lang>

=={{header|ML/I}}==
ML/I will read two integers from 'standard input' or similar, and then output the results to 'standard output' or similar.

<lang ML/I>MCSKIP "WITH" NL
"" Arithmetic/Integer
"" assumes macros on input stream 1, terminal on stream 2
MCSKIP MT,<>
MCINS %.
MCDEF SL SPACES NL AS <MCSET T1=%A1.
MCSET T2=%A2.
a + b = %%T1.+%T2..
a - b = %%T1.-%T2..
a * b = %%T1.*%T2..
a / b = %%T1./%T2..
a rem b = %%T1.-%%%T1./%T2..*%T2...
Division is truncated to the greatest integer
that does not exceed the exact result. Remainder matches
the sign of the second operand, if the signs differ.</lang>


=={{header|Modula-2}}==
=={{header|Modula-2}}==