HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Functions > problem:


060. 50727 - Fibonacci Numbers

Guest
• Review clarifications (2)

Volume problems

• 010. 50582 - Number of digits
• 016. 50459 - The Biggest Digit
• 020. 50575 - Number of Prime num...
• 030. 50576 - Number of Perfect nu...
• 035. 50467 - Random Numbers
• 040. 50354 - Intersecting Rectangles
• 050. 50510 - What floor are they?
• 050. 50566 - Grade Point Average (...
• 060. 50727 - Fibonacci Numbers
• 061. 50733 - The Highest Average
• 062. 50390 - Total Salary Paid
• 066. 50523 - Total Tax to Pay
• 070. 50534 - Top Trading Company
• 076. 50289 - Monthly Allowance
• 080. 50347 - Selling Oranges
• 090. 50378 - Sum of the given digits
• 095. 50453 - The Cubic Difference

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Ibrahim Mesecan.

Fibonacci Numbers

Although first described in India, The Fibonacci sequence has become famous after Fibonacci introduced it in his book Liber Abaci. Except the first two numbers (Fibonacci(0)=1 and Fibonacci(1)=1), Fibonacci numbers are formed as the sum of previous 2 Fibonacci numbers.
Fibonacci(2)= Fibonacci(1) + Fibonacci(0);
Fibonacci(3)= Fibonacci(2) + Fibonacci(1);
Fibonacci(4)= Fibonacci(3) + Fibonacci(2);
etc..

Question:
Write a program that calculates nth element of the Fibonacci sequence.

Input specification
You will be given one integer number (n) where 0 ≤ n ≤ 30

Output specification
Show one integer number which is nth element of the Fibonacci sequence.

Sample Input I   
  5
Sample Input II   
  12
Sample Output I   
  8
Sample Output II   
  233


Для отправки решений необходимо выполнить вход.

www.contester.ru