Fibonacci Series

Fibonacci Series

Write a method that will print the nth number in the Fibonacci series. The Fibonacci sequence is a series of numbers where a number is found by adding up the two numbers before it. Starting with 1, the sequence goes 1, 1, 2, 3, 5, 8, 13, 21, 34, and so forth. Written as a rule, the expression is Xn = Xn-1 + Xn-2.

Example 1:


input data:
10
output:
55

Example 2:


input data:
5
output:
5
View Code Template
View Java Solution

Seda
Seda Kunda is a web designer and developer with a degree in Computer Science and a great passion for code. Besides code, she enjoys pepperoni pizza, watching the bachelor and sleeping in on Saturdays.
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn