Greatest common divisor: Difference between revisions
Content added Content deleted
(added MiniScript example) |
|||
Line 2,699: | Line 2,699: | ||
0B C2 JNZ Again |
0B C2 JNZ Again |
||
0C 80 JZ GCD // Display GCD in R0</lang> |
0C 80 JZ GCD // Display GCD in R0</lang> |
||
=={{header|MiniScript}}== |
|||
<lang MiniScript>gcd = function(a, b) |
|||
while b |
|||
temp = b |
|||
b = a % b |
|||
a = temp |
|||
end while |
|||
return abs(a) |
|||
end function |
|||
print gcd(18,12)</lang> |
|||
{{output}} |
|||
<pre>6</pre> |
|||
=={{header|MIPS Assembly}}== |
=={{header|MIPS Assembly}}== |