Commit 6ee6b0b
committed
feat: Implement Fibonacci sequence generator to find nth number
📌 Logic:
- Takes an integer `n` as input to find the nth number in the Fibonacci sequence.
- Initializes first two terms: `a = 0` and `b = 1`.
- Iteratively calculates the next Fibonacci numbers using:
`b = a + b` and `a = previous b`
- Loop continues until the nth term is reached (starting count from 2).
- Outputs the nth Fibonacci number.
Signed-off-by: Somesh diwan <[email protected]>1 parent 2a19b47 commit 6ee6b0b
File tree
1 file changed
+3
-3
lines changed- Section7ConditionalStatements/Practice/src
1 file changed
+3
-3
lines changedLines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
0 commit comments