HW #1 - Fibonacci Numbers

Due Monday, Jan. 29 at 3:30 PM

Your assignment is to use the JOEL programming language to write a program that will find the first n Fibonacci numbers, 1 <= n <= 23 (your program must make sure this is true).

The first two Fibonacci numbers are 1 and 1. To generate the nth number in the series, you add the (n-1)th and (n-2)th numbers. So, the third number is 1+1=2, the fourth number is 1+2=3, the fifth is 2+3=5, the sixth is 3+5=8, and so on.

For purposes of checking your work, here are the first 23 Fibonacci numbers:

1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
10946
17711
28657

Turning in Your Program

When you turn this in, you should include:
* source code (saved as a plain text file) on a floppy disk or on my computer
* printed source code
* printed test run. (You'll notice that you can't print directly from the MS-DOS prompt. On Windows 98, you have to click on the first button on the left, highlight your text, then click on the second button to copy it to the clipboard - then paste into a text editor and print. In Windows 2000/NT, click on the MS-DOS icon in the top left of the window to get the edit menu. If that's still too complicated for you, there are pictures with arrows here.)

Resources

JOEL language resources are on the main course server, binky. There are a description of the language and the JOEL interpreter. To use the interpreter, put your program (saved as a text file with line numbers) in the same folder with the interpreter, then run the interpreter from the command line. (In Windows 2000/NT (I think), go to Start -> Run, and type "cmd". In Windows 98, go to Start -> Programs -> MS-DOS Prompt. Then navigate to the appropriate directory by typing "cd desired_directory", and then type "joel program_name_with_extension" to run your program.)

More about Fibonacci numbers

Pretty pictures with Fibonacci numbers


Main Page