Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Greatest Common Divider and Freebasic

3 views
Skip to first unread message

Geeza

unread,
Apr 3, 2008, 10:29:55 AM4/3/08
to
The freebasic site is down currently and i'm looking at calculating a GCD using Freebasic. I did look before, but i couldn't find much documentation on it.

TIA


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

Tom Lake

unread,
Apr 3, 2008, 11:11:59 AM4/3/08
to

"Geeza" <a...@mouse.com> wrote in message news:zR5Jj.2379$tW....@newsfet29.ams...

> The freebasic site is down currently and i'm looking at calculating a GCD using
> Freebasic. I did look before, but i couldn't find much documentation on it.
>
> TIA

Here's a version:

'----------------------------------------------------------------
declare function gcd(x,y)
print gcd(112,144)
sleep
function gcd(x,y)
do
q=int(x/y)
r=x-q*y
x=y
y=r
loop until r<=0
gcd=x
end function
'----------------------------------------------------------------

Example:

print gcd(112,144)

16

Tom Lake

0 new messages