代码如下:
package cn.thinkinjava.yys; public class Exercise9 { public static int num(int n) { if(n == 1){ return 1; } if (n == 2) { return 1; }else{ return num(n - 1) + num(n - 2); } } public static void main(String[] args) { int i = Integer.parseInt(args[0]); System.out.println("First"+i+"Fibonacci number(s):"); for (int j = 0; j <= i; j++) { System.out.println(num(j)); } }} 运行一直出错
原文地址:https://www.cnblogs.com/yyslif/p/11172242.html
时间: 2024-10-29 05:05:37