Board logo

標題: 費式數列-使用遞迴 [打印本頁]

作者: 李泳霖    時間: 2023-3-30 16:44     標題: 費式數列-使用遞迴

Write a C function Fabonacci(n) to list Fibonacci numver F,where

Fn=Fn-1+Fn-2
F1=F2=1

For example , if you enter "8" for n,it will list the results of Fn as follows:
F1=1
F2=2
F3=2
F4=3
F5=5
F6=8
F7=13
F8=21
Note:you may find solution by recursive function to solove question,please fix the question by loop and don't use recursive function this time.

本帖隱藏的內容需要回復才可以瀏覽





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2