#include <iostream> using namespace std; void PrintFibonacci(int n){ unsigned long long a = 0, b = 1, c; cout << a << ", " << b; for(int i = 2; i < n; ++i){ c = a + b; cout << ", " << c; a = b; b = c; } } int main() { int numberOfTerms = 100; cout << "Fibonacci series for 100 terms:" << endl; PrintFibonacci(numberOfTerms); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter