Back
Fibonacci.cpp
Save
// Fibonacci.cpp #include
using namespace std; int Fibonacci(int *a, int n) { a[1] = a[2] = 1; for (int i = 3; i <= n; i++) { a[i]= a[i-1] + a[i-2]; } return a[n]; } int main() { int a[100]; int n = 10; cout << "Ket qua: " << Fibonacci(a, n) << endl; return 0; }