Created
August 6, 2016 20:55
-
-
Save GibranPolonsky/a6ad900a020febf6010b9b05b7f849b0 to your computer and use it in GitHub Desktop.
Fibonacci Function C++
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int fibonacci(){ | |
int end; | |
cout << "Ingrese un fin para la serie: "; | |
cin >> end; | |
int a = 1, b = 1, sum = 0; | |
for(unsigned i = 0; i<end; i++){ | |
sum = a + b; | |
a = b; | |
b = sum; | |
cout << sum << endl; | |
} | |
cin >> end; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment