06-20-2015, 03:48 PM

1) Fibonacci series

In fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. The first two numbers of fibonacci series are 0 and 1.

Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem.

Most computer programming languages support recursion by allowing a function to call itself within the program text.

Fibonacci Series without using recursion

Fibonacci Series using recursion

Code:

`Write a java program to print fibonacci series without using recursion and using recursion.`

Input: 10

Output: 0 1 1 2 3 5 8 13 21 34

In fibonacci series, next number is the sum of previous two numbers for example 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. The first two numbers of fibonacci series are 0 and 1.

Recursion in computer science is a method where the solution to a problem depends on solutions to smaller instances of the same problem.

Most computer programming languages support recursion by allowing a function to call itself within the program text.

Fibonacci Series without using recursion

Spoiler(Show)

Fibonacci Series using recursion

Spoiler(Show)