package Algorithm;//递归实现斐波那契数列import java.util.Scanner;public class Practice02 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入你要查找数列某项的数:
package Algorithm;
//递归实现斐波那契数列
import java.util.Scanner;
public class Practice02 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入你要查找数列某项的数:");
int i = sc.nextInt();
System.out.println(get(i));
}
public static int get(int n) {
if (n <= 2) {
return 1;
} else {
return get(n - 2) + get(n - 1);
}
}
}