Print Fibonacci series for first 100 terms.
Thu Jan 30 2025 09:21:03 GMT+0000 (Coordinated Universal Time)
Saved by
@Rohan@99
#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;
}
content_copyCOPY
Comments