Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 842 Bytes

README.md

File metadata and controls

28 lines (18 loc) · 842 Bytes

C++ Fibonacci Sequence

The Fibonacci numbers may be defined by the recurrence relation.

Fn = F(n-1) + F(n-2)

The first 10 Fibonacci numbers Fn are:

n = 0 1 2 3 4 5 6 7 8 9
Fn = 0 1 1 2 3 5 8 13 21 34

Update 2023/08/06 - v.1.1:

  • Added sequence calculation using recursive function;
  • Added the header file cmath;
  • Fixed system("CLS") to system("clear || cls");
  • Source code organized by scope.

Run on Linux

g++ FibonacciSequence.cpp -o FibonacciSequence

./FibonacciSequence

Sources

Wikipedia: Fibonacci Number

Math is Fun: Fibonacci Sequence