Jump to content

Arithmetic/Integer: Difference between revisions

m
Line 94:
 
=={{header|ALGOL 68}}==
{{trans|C}}
 
{{works with|ALGOL 68|Revision 1 - no extensions to language used}}
 
{{works with|ALGOL 68G|Any - tested with release [http://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.18.0/algol68g-1.18.0-9h.tiny.el5.centos.fc11.i386.rpm/download 1.18.0-9h.tiny]}}
{{wont work with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d] - due to extensive use of FORMATted transput}}
<lang algol68>main:(
LONG INT a=355, b=113;
Line 103 ⟶ 109:
printf(($"a MOD b = a%*b = a%×b = a÷×b = a÷*b = "gl$, a %* b));
printf(($"a UP b = a**b = a↑b = "gl$, a ** b))
)</lang>
)</lang>Output:<lang algol68>a+b = +468
Output:
<pre>
)</lang>Output:<lang algol68>a+b = +468
a-b = +242
a*b = a×b = +40115
Line 109 ⟶ 118:
a OVER b = a%b = a÷b = +3
a MOD b = a%*b = a%×b = a÷×b = a÷*b = +16
a UP b = a**b = a↑b = +1.499007808785573768814747570e+288</lang>
</pre>
[[ALGOL 68R]] has the curious (and consequently non-standard) /:= operator. This operator
delivers two INTs as a result. eg.
Cookies help us deliver our services. By using our services, you agree to our use of cookies.