Question: USING R STUDIO Please run the following code and annotate it with explanations of what you think the code is doing with comment statements. #

USING R STUDIO

Please run the following code and annotate it with explanations of what you think the code is doing with comment statements.

# PRODUCT OF FIBONACCI NUMBERS

n = 20

Fibonacci <- rep(0, n)

Fibonacci[1] <- 1

Fibonacci[2] <- 1

Product <- 1

for (i in 3:n)

{

Fibonacci[i] <- (Fibonacci[i - 1]) + (Fibonacci[i - 2])

Product <- Fibonacci[i]*Product

}

Fibonacci[1:n]

Fibonacci[n]

Product

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!