Greatest common divisor: Difference between revisions

Content added Content deleted
m (Fix last image position)
(Changed to show GCD of 0 and 0 as 0.)
Line 3,464: Line 3,464:
a = fn ControlIntegerValue( _fldA )
a = fn ControlIntegerValue( _fldA )
b = fn ControlIntegerValue( _fldB )
b = fn ControlIntegerValue( _fldB )
if a + b == 0 then textlabel _ansA, @"=" : textlabel _ansB, @"=" : exit fn
if a + b == 0 then textlabel _ansA, @"= 0" : textlabel _ansB, @"= 0" : exit fn
c = fn GCD( a, b )
c = fn GCD( a, b )
textlabel _ansA, fn stringwithformat(@"= %ld x %ld", c, a / c )
textlabel _ansA, fn stringwithformat(@"= %ld x %ld", c, a / c )