First 40 Fibonacci Numbers

Highlight the following code and save it as a text file called FIBON.BAS
Put it in the same folder as GW-BASIC.EXE. Load it and run it.

10 REM First 40 Fibonacci Numbers 
20 CLEAR :CLS
30 TEMP = 0
40 FIB = 1
50 FOR NUMBER = 1 TO 40
60    PRINT USING "##########";FIB;
70    PAIR = TEMP + FIB
80    TEMP = FIB
90    FIB = PAIR
100 NEXT NUMBER
110 END

Previous | Home Next