摘要: //递归的算法 private int fat(int b){ //递归的特点就是要找到出口 if(b == 2 || b == 1 ){ return 1; } return fat(b-1) + fat(b-2); } //迭代的方法 public static void ff(int index){ int a = 1; int b = 1; int c = 0; int i = 0; while(i < index ){ c = a + b; a = b; b = c; System.out.println(c); i ++ ; } } 阅读全文
posted @ 2013-08-28 10:04 lifeng_study 阅读(1100) 评论(0) 推荐(0) 编辑