7.2 Fibonacci Series |
Write a program that prints out the first 21 elements in the Fibonacci Series.
This program will probably use the for
loop.
The series starts with a zero(0) and a one(1). Each subsequent number is the sum of the previous two numbers.
So:
Number the first number in the series, the zero with a zero. With this numbering LCD(Fn,Fm) = F(LCD(n,m)).
Your program need to print the following:
Other requirements:
#define
for the initial number of robots
and the end point constants.
printf
format string of" %6d %6d\n"
Hints:
Study areas:
for
statement. Hanly & Koffman page 222.
Kernighan p13 & p60.
Harbison p243-247.
printf()
function. Hanly & Koffman pages 48-50 and pages 612-615.
Kernighan p7, p11, & p153.
Harbison p366+.
Extra credit:
Make sure that your program run sand prints the twenty-first Fibonacci number. Mark your output with:
Please turn your lab in to me, Louis Taber, during class, or slide it under the door of Santa Rita Building room A-115 (my office).
7.2 Fibonacci Series |