TORONTO KIDS COMPUTER CLUB | Markham Saturday 14:00 Java Homework 20.05.30.
17603
post-template-default,single,single-post,postid-17603,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

Markham Saturday 14:00 Java Homework 20.05.30.

05 Jun Markham Saturday 14:00 Java Homework 20.05.30.

Question:
Use recursion to print the Nth number in the fibonacci sequence.

Note : The Fibonacci Sequence is the series of numbers, the first two numbers are 0 and 1 :

0, 1, 1, 2, 3, 5, 8, 13, 21, ….

Every next number is found by adding up the two numbers before it.

Sample Input 1:
1

Sample Output 1:
0

Sample Input 2:
2

Sample Output 2:
1

Sample Input 3:
5

Sample Output 3:
3

Sample Input 4:
7

Sample Output 4:
8
No Comments

Sorry, the comment form is closed at this time.