[Login|Register]
Problems

Status

Rank

Problem 1003
Fibonacci Numbers
Time Limit: 1000ms
Memory Limit: 65536kb
Description
The Fibonacci numbers (0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...) are defined by the recurrence:
An = An-1 + An-2, if n >= 2

Write a program to calculate the Fibonacci Numbers.
Input
The input to your program would be a sequence of numbers smaller or equal than 40, each on a separate line, specifying which Fibonacci number to calculate.
Output
Your program should output the Fibonacci number for each input value, one per line.
Sample Input
5
7
11
Sample Output
The Fibonacci number for 5 is 5
The Fibonacci number for 7 is 13
The Fibonacci number for 11 is 89
University of Science and Technology of China
Online Judge for ACM/ICPC
Processed in 1.8ms with 1 query(s).