Jump to content

Greatest common divisor: Difference between revisions

Added LOLCODE section
(add Tiny BASIC)
(Added LOLCODE section)
Line 2,425:
end</lang>
 
=={{header|LOLCODE}}==
<lang LOLCODE>HAI 1.3
 
HOW IZ I gcd YR a AN YR b
a R BIGGR OF a AN PRODUKT OF a AN -1 BTW absolute value of a
b R BIGGR OF b AN PRODUKT OF b AN -1 BTW absolute value of b
BOTH SAEM a AN b, O RLY?
YA RLY
FOUND YR a
OIC
BOTH SAEM a AN 0, O RLY?
YA RLY
FOUND YR b
OIC
BOTH SAEM b AN 0, O RLY?
YA RLY
FOUND YR a
OIC
BOTH SAEM b AN BIGGR OF a AN b, O RLY? BTW make sure a is the larger of (a, b)
YA RLY
I HAS A temp ITZ a
a R b
b R temp
OIC
 
IM IN YR loop
I HAS A temp ITZ b
b R MOD OF a AN b
a R temp
BOTH SAEM b AN 0, O RLY?
YA RLY
FOUND YR a
OIC
IM OUTTA YR loop
IF U SAY SO
 
VISIBLE I IZ gcd YR 40902 AN YR 24140 MKAY
 
KTHXBYE</lang>
=={{header|LSE}}==
<lang LSE>(*
Cookies help us deliver our services. By using our services, you agree to our use of cookies.