用C語言證明費波拉契數列中Fn+1/Fn等於黃金分割。要求有輸入輸出
int foo(int n)
{
if (n == 1 || n == 2)
return 1;
return foo(n - 1) + foo(n - 2);
}
int main()
{
for (int i = 1; i < 20; i++)
{
cout << foo(i) / (double)foo(i + 1) << endl;
}
}