Greatest common divisor: Difference between revisions

m
No edit summary
Line 56:
 
=={{header|ALGOL 68}}==
{{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>PROC gcd = (INT a, b) INT: (
IF a = 0 THEN
Line 67 ⟶ 71:
FI
);
test:(
 
main : (
INT a = 33, b = 77;
printf(($x"The gcd of"g" and "g" is "gl$,a,b,gcd(a,b)));
Line 74 ⟶ 77:
printf(($x"The gcd of"g" and "g" is "gl$,c,d,gcd(c,d)))
)</lang>
Output:
The output is:
<pre>
<lang algol68>The gcd of +33 and +77 is +11
The gcd of +4986533 and +6981177 is +9973</lang>11
<lang algol68> The gcd of +3349865 and +7769811 is +119973
</pre>
 
== {{header|APL}} ==