Greatest common divisor: Difference between revisions
Content added Content deleted
m (→{{header|PowerShell}}: some whitespace to make reading easier) |
No edit summary |
||
Line 854: | Line 854: | ||
<lang nial>|gcd 9 6 3 |
<lang nial>|gcd 9 6 3 |
||
=3</lang> |
=3</lang> |
||
=={{header|Objeck}}== |
|||
<lang objeck> |
|||
bundle Default { |
|||
class GDC { |
|||
function : Main(args : String[]), Nil { |
|||
for(x := 1; x < 36; x += 1;) { |
|||
IO.Console->GetInstance()->Print("GCD of ")->Print(36)->Print(" and ")->Print(x)->Print(" is ")->PrintLine(GDC(36, x)); |
|||
}; |
|||
} |
|||
function : native : GDC(a : Int, b : Int), Int { |
|||
t : Int; |
|||
if(a > b) { |
|||
t := b; b := a; a := t; |
|||
}; |
|||
while (b <> 0) { |
|||
t := a % b; a := b; b := t; |
|||
}; |
|||
return a; |
|||
} |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|OCaml}}== |
=={{header|OCaml}}== |