Factorial in Basic
Example for versions bwBASIC 2.50
Factorials are calculated iteratively. Note the type inference: data type for storing factorial values is not declared explicitly, and yet the larger values are calculated without an overflow error.
f = 1 FOR i = 0 TO 16 PRINT i; "! ="; f f = f * (i + 1) NEXT i