MY CODE: public class Fibonacci { public static void main(String[] args) {
Fantastic news! We've Found the answer you've been seeking!
Question:
MY CODE:
public class Fibonacci { public static void main(String[] args) { int n = 10; int y = fibonacci(n); System.out.println("The " + n + "th term of the Fibonacci sequence is " + y + "."); } public static int fibonacci(int n) { if(n == 0) { return 0; } if(n == 1) { return 1; } return fibonacci(n - 1) + fibonacci(n - 2); } }
Adding it into GitHub:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date: