#include <iostream> using namespace std; int Fibonacci(int n) { if (n == 1 || n == 2) return 1; else return Fibonacci(n - 1) + Fibonacci(n - 2); } int main() { int n; cout << "请输入正整数n:"; cin >> n; cout << "斐波那契数列的前n项为:" << endl; for (int t = 1; t <= n; t++) { cout << Fibonacci(t) << '\t'; } cout << endl; return 0; }