import java.util.Scanner;
public class Solution {
public static int Fibonacci(int n) {
int first = 0, second = 1,target=0;

if (n < 2)
return n ;
for (int i = 0; i < n-1; i++)
{
target = first + second;
first = second;
second = target;
}

return target;
}


public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int num=Fibonacci(n);
System.out.println(""+num);


}
}

相关文章:

  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2021-12-30
  • 2021-06-29
  • 2021-09-03
猜你喜欢
  • 2022-02-15
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
相关资源
相似解决方案