class="java" name="code">import java.util.Scanner; public class Fibonacci { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("pls input number"); int i = sc.nextInt(); for (int j = 1; j <= i; j++) { int number = fibonacci(j); System.out.println(number); } } static int fibonacci(int n) { if (n <= 2) { return 1; } else { return fibonacci(n - 2) + fibonacci(n - 1); } } }
?