BCX Console Demonstration Program s56.bas

 DIM A!
 DIM B!
 DIM C!
 
 A! = 561
 B! = 633
 
 C! = Gcd!(A!, B!)
 
 PRINT  C!, " *", A! / C!, " =", A!
 PRINT  C!, " *", B! / C!, " =", B!
 
 FUNCTION Gcd!(X!, Y!)
   '--------------------- 
   'Using Euclid's Method 
   '--------------------- 
   LOCAL Z!
   Z! = 1
   WHILE Z! > 0
     Z! = MOD(X!, Y!)
     X! = Y!
     Y! = Z!
   WEND
   FUNCTION = X!
 END FUNCTION