bas7ex.hlp (Topic list)
EXP Function Programming Example
                       Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
'This example uses the EXP function to calculate the growth of a bacterial
'colony over a 15-day period. The program prompts you for an initial
'population and the rate of growth.
 
CLS    'Clear screen.
INPUT "Initial bacterial population"; Colony0
INPUT "Growth rate per day as a percentage of population"; Rate
R = Rate / 100 : Form$ = "##  ###,###,###,###"
PRINT : PRINT "Day        Population"
FOR T = 0 TO 15 STEP 5
    PRINT USING Form$; T, Colony0 * EXP(R * T)
NEXT
 
'Sample Output
'
'Initial bacterial population? 10000
'Growth rate per day as a percentage of population? 10
'
'Day        Population
' 0           10,000
' 5           16,487
'10           27,183
'15           44,817