DirectFileTopicDownload 2
DirectFileTopicDownload 2
The Fibonacci Sequence, Part 2. In a new class, modify your main method code from part 1 to
F
create an array of the first n Fibonacci numbers. You will need a loop for this, but do not change
22
the recursive method! Your main method should ask for the value of n, and calculate all values
from fib(1) to fib(n). Note: fib(1) = 1 and fib(2) = 1, but you’re using array indexes!
e,
Recursive Printing. Create a recursive method, printUp(int n) to print the following pattern for
any n>0 rows: (this shows n=5).
l
so
*
on
**
***
C
****
*****
y
nn
Also create a recursive method, printDown(int n) to print the following pattern for any n>0
rows: (this shows n=5)
oh
*****
.J
****
***
of
**
Pr
*
You will need loops in your recursive methods for this question, but only to print the number of
T
asterisks. Your main method should ask for the value of n and call each method in order.
H
IG
*
**
***
O
****
C
*****
*****
****
***
**
*
Your methods in this lab must be recursive. If they are not, you will receive a zero.
Copyright © 2021-2022 by Prof. Johnny Console, Algoma University.
All rights reserved. No parts of this work may be reproduced by any means without prior
written permission from the author.