include "ConsoleWindow" local fn factorialIterative( n as long ) as double dim as double f dim as long i if ( n > 1 ) f = 1 for i = 2 To n f = f * i next i else f = 1 end if end fn = f local fn factorialRecursive( n as long ) as double dim as double f if ( n < 2 ) f = 1 else f = n * fn factorialRecursive( n -1 ) end if end fn = f dim as long i for i = 0 to 12 print "Iterative:"; using "####"; i; " ="; fn factorialIterative( i ) print "Recursive:"; using "####"; i; " ="; fn factorialRecursive( i ) print next i