0

How to print fibonacci series

i need code

21st Jun 2017, 5:40 PM
Aditya Wadhwa
Aditya Wadhwa - avatar
2 Answers
+ 1
int fib(int n) { if(n==0)return 0; else if(n==1)return 1; else return fib(n-1)+fib(n-2); } it is a recursive function to print each term of Fibonacci series now just take a loop from 1 to desired limit and call this function;
22nd Jun 2017, 8:28 AM
Vaibhav Tandon
Vaibhav Tandon - avatar
0
I have just code in java. Try to convert it. https://code.sololearn.com/cM8HVyQmi6ut/?ref=app
21st Jun 2017, 8:41 PM
Jonas Schröter
Jonas Schröter - avatar