The Fibonacci series is computed as follows:
Write the R function fibo(n) using a for loop
(without any recursion) that returns the first n
numbers in the Fibonacci series.
The function returns a vector with the first n
fibonacci numbers.
Test the function with the following values and provide the
resulting outputs along with the R code.
> fibo(10)
Expected output:
[1] 0 1 1 2 3 5 8 13 21 34
> fibo(13)
Expected output:
[1] 0 1 1 2 3 5 8 13 21 34 55 89 144
The Fibonacci series is computed as follows: Write the R function fibo(n) using a for loop (without any recursion) that
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
The Fibonacci series is computed as follows: Write the R function fibo(n) using a for loop (without any recursion) that
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!