Skip to content

Instantly share code, notes, and snippets.

@GibranPolonsky
Created August 6, 2016 20:55
Show Gist options
  • Save GibranPolonsky/a6ad900a020febf6010b9b05b7f849b0 to your computer and use it in GitHub Desktop.
Save GibranPolonsky/a6ad900a020febf6010b9b05b7f849b0 to your computer and use it in GitHub Desktop.
Fibonacci Function C++
#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