I have the follow code for a recursive Fibonacci Sequence
if (term < 2){
System.out.print("1 ");
return 1;
}
int results = fibonacci(term - 1) + fibonacci(term - 2);
System.out.print(results + " ");
return results;
The output I get is
What term would you like to do the Fibonacci Sequence up to: 4
1 1 2 1 3 1 1 2 5 The 4th is 5
How do I make it so it prints
1 1 2 3 The 4th is 5