菲波那切数列->switf

func getFinboNum(num: Int) ->Int{
if num == 1 || num == 2 {
return 1
}
return (getFinboNum(num: num - 1) + getFinboNum(num: num - 2))
}

for month in 1...10{
print("(month):(getFinboNum(num: month))")
}

你可能感兴趣的:(菲波那切数列->switf)