Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Compiler > Re: Greatest Co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 146 of 149
Post > Topic >>

Re: Greatest Common Divider and Freebasic

by "Tom Lake" <tlake@[EMAIL PROTECTED] > Apr 3, 2008 at 11:11 AM

"Geeza" <a@[EMAIL PROTECTED]
> wrote in message
news:zR5Jj.2379$tW.1956@[EMAIL PROTECTED]
> 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




 2 Posts in Topic:
Greatest Common Divider and Freebasic
"Geeza" <a@[  2008-04-03 15:29:55 
Re: Greatest Common Divider and Freebasic
"Tom Lake" <  2008-04-03 11:11:59 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 7:53:36 CDT 2008.