include "ConsoleWindow" clear local mode local fn IntegerFactors( f as long ) as Str255 dim as long i, s, l(100), c : c = 0 dim as Str255 factorStr for i = 1 to sqr(f) if ( f mod i == 0 ) l(c) = i c++ if ( f <> i ^ 2 ) l(c) = ( f / i ) c++ end if end if next i s = 1 while ( s = 1 ) s = 0 for i = 0 to c-1 if l(i) > l(i+1) and l(i+1) <> 0 swap l(i), l(i+1) s = 1 end if next i wend for i = 0 to c-1 if ( i < c -1 ) factorStr = factorStr + str$(l(i)) + "," else factorStr = factorStr + str$(l(i)) end if next end fn = factorStr print "Factors of 25 are:"; fn IntegerFactors( 25 ) print "Factors of 45 are:"; fn IntegerFactors( 45 ) print "Factors of 103 are:"; fn IntegerFactors( 103 ) print "Factors of 760 are:"; fn IntegerFactors( 760 ) print "Factors of 12345 are:"; fn IntegerFactors( 12345 ) print "Factors of 32766 are:"; fn IntegerFactors( 32766 ) print "Factors of 32767 are:"; fn IntegerFactors( 32767 ) print "Factors of 57097 are:"; fn IntegerFactors( 57097 ) print "Factors of 12345678 are:"; fn IntegerFactors( 12345678 ) print "Factors of 32434243 are:"; fn IntegerFactors( 32434243 )