Page 1 of 1

Lab Exercise: Write a java program to print the fibonacci number at index 4 ( use recursive call ) public class demo_Lab

Posted: Sat May 14, 2022 6:37 pm
by answerhappygod
Lab Exercise Write A Java Program To Print The Fibonacci Number At Index 4 Use Recursive Call Public Class Demo Lab 1
Lab Exercise Write A Java Program To Print The Fibonacci Number At Index 4 Use Recursive Call Public Class Demo Lab 1 (35.3 KiB) Viewed 33 times
Lab Exercise: Write a java program to print the fibonacci number at index 4 ( use recursive call ) public class demo_Lab { public static void main(String[] args) { System.out.println("The Fibonacci number at index 4 is " + fib(4)); > 7. The method for finding the Fibonacci number */ public static long fib(long index) { 1/ TODO:complete the fib method Il fib(0) = 0; flb(1) = 1; 11 fib(index) = fib(index -1) +fib(index -2); index >=2