Submission
Status:
P---------
Score: 10
User: un8qe_x3
Problemset: อนุกรม
Language: cpp
Time: 0.002 second
Submitted On: 2025-03-14 11:58:22
#include <iostream>
#include <string>
using namespace std;
int fib(int n) {
if (n == 0) {
return 0;
} else if (n == 1) {
return 1;
}
int a = 0, b = 1;
cout << "temp" << " b" << " a" << "\r\n";
for (int i = 2; i <= n; i++) {
int temp = b;
b = a + b;
a = temp;
cout << temp << " " << b << " " << a << "\r\n";
}
cout << "b = " ;
return b;
}
int main() {
int npt;
cin >> npt;
cout << fib(npt) << endl;
return 0;
}