faqts : Computers : Programming : Languages : Bbcbasic

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

Entry

BBCBASIC: Windows: Mathematics: How to calculate the smallest common multiple?

Apr 26th, 2006 11:39
Knud van Eeden,


REM library: smallest: common: multiple: iterative 
(filenamemacro=commsmmi.bbc) [kn, amv, we, 26-04-2006 18:18:55]

DEF FNSmallestCommonMultiple( number1I%, number2I% )

 REM e.g. REM goal: determine of 2 numbers

 REM e.g. REM

 REM e.g. REM The smallest common multiple

 REM e.g. :

 REM e.g. PRINT FNSmallestCommonMultiple( 10, 20 ) : REM gives 20

 REM e.g. PRINT FNSmallestCommonMultiple( 2, 13 ) : REM gives 26

 REM e.g. PRINT FNSmallestCommonMultiple( 1231232, 1234 ) : REM gives 
759670144

 REM e.g. END

 REM e.g. :

 REM e.g. :

 REM e.g. :

REM = number1I% * number2I% / FNGreatestCommonDivisorRecursive( 
number1I%, number2I% )

= number1I% * number2I% / FNGreatestCommonDivisorIterative( number1I%, 
number2I% )

: