scala递归实现斐波那契数列1,1,2,3,5,8,13,21_scala给定一个斐波那契数列:12 3 5 8 13 21 34 55 89 …编写一个递归函数 -CSDN博客

网站介绍:文章浏览阅读2k次。object ImplicitFunc { //类def main(args: Array[String]): Unit = { //main方法import scala.collection.mutable.ArrayBuffer //ArrayBuffer包使数组可变def dg(n: Int): Array[Int] = { //类型为Int def func(n: Int): Int = { //定义方法 if (n<=2) 1 else _scala给定一个斐波那契数列:12 3 5 8 13 21 34 55 89 …编写一个递归函数 ,de