Skip to content

Commit

Permalink
Added necessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JanaSabuj committed Mar 3, 2020
1 parent b477998 commit 880c54e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Fibonacci_Number/Fibonacci_Number.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Problem Statement(1): Find the nth Fibonacci number
// Problem Statement(1): Find the nth Fibonacci number
// (1.a) Using Recusrsion
// (1.b) Using Dynamic Programming(DP)
// Problem Statement(2): Print the Fibonacci series
// Problem Statement(2): Print the Fibonacci series

// 1.a Using Recusrion to find the nth fibonacci number
// 1.a Using Recusrion to find the nth fibonacci number
const FibonacciNumberRec = num => {
if (num <= 1) return num;
return FibonacciNumberRec(num - 1) + FibonacciNumberRec(num - 2);
Expand Down Expand Up @@ -39,12 +39,14 @@ console.log(`The ${n}th Fibonacci Number is ${FibonacciNumberDP(n)}`);
n = 10;
console.log(`The Fibonacci Series upto ${n}th term is ${FibonacciSeries(n)}`);

// I/O:
// Input:
// 1.a) n = 6
// Output :
// The 6th Fibonacci Number is 8
// Input:
// 1.b) n = 8
// The 8th Fibonacci Number is 21
// Input:
// 2. n = 10
// The Fibonacci Series upto 10th term is 0,1,1,2,3,5,8,13,21,34,55

Expand Down

0 comments on commit 880c54e

Please sign in to comment.