Created
January 28, 2023 15:46
-
-
Save lipx1508/7d8bb91e628911e8e762d4c0c2ba68ae to your computer and use it in GitHub Desktop.
Really basic implementation of Fibonacci's formula in C++, please don't blame me if something is written badly. I'm not a GREAT programmer tho.
This file contains 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
// Basic implementation of Fibonacci's sequence in C++. | |
#include <iostream> | |
int main(int argc, char * argv[]) { | |
unsigned int x, y, z, n; | |
std::cout << "Number of iterations: "; | |
std::cin >> n; | |
for (unsigned int i = 0; i < n; i++) { | |
z = x + y, x = y, y = z; | |
std::cout << z << '\n'; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment