We need to write a program that prints the n-th Fibonacci number for n between 0 and 44 inclusive, with the given definition: fib(0)=1, fib(1)=1, and for n>1, fib(n)=fib(n-1)+fib(n-2). Note: This definition yields the sequence: 1,1,2,3,5,8,... So fib(3)=3. That matches example.
Constraints small, so we can compute iteratively or recursively with memoization. But to be safe and efficient, we can use a simple loop.
The prompt: "Write a program which prints n-th fibonacci number for a given integer n." Possibly expects reading input, computing, output.
We need to produce code in some language? Not specified. Usually, in these contexts, one could choose any common language; but perhaps the platform expects a specific language? The problem statement does not specify a language. Since the user wrote "Write a program", we need to output a program. Possibly they want a solution in a specific programming language like Python, C++, Java, etc. The user hasn't indicated. In such scenarios, we can provide a solution in a popular language like Python.
Given the nature of the problem, it's likely from some online judge like Aizu, which often accepts multiple languages. But we need to produce the final answer. I'll assume Python 3, as it's concise and commonly used.
We'll implement: read integer n from input, compute fib, print.
Since n <= 44, recursion naive is okay but iterative is better.
Implementation:
def fib(n):
if n <= 1:
return 1
a, b = 1, 1
for i in range(2, n+1):
a, b = b, a + b
return b
But careful: For n=0, we should return 1. For n=1, return 1. Then for n=2, loop: i=2: a=1, b=1 -> a,b = 1,2 -> b=2. Works.
Alternatively, we can initialize a=1, b=1, and for i from 2 to n inclusive, compute c = a+b, then a=b, b=c. Then print b.
Edge cases: n=0: we should output 1. Loop from 2 to 0? That's empty, so b remains 1. Works. n=1: loop from 2 to 1 empty, b=1.
So code:
import sys
def main():
n = int(sys.stdin.readline())
a, b = 1, 1
for _ in range(2, n+1):
a, b = b, a + b
print(b)
if name == "main":
main()
We could also read from input().
I'll produce a complete program.
Note: If the problem expects the standard Fibonacci where fib(0)=0, fib(1)=1, but here it's given as 1,1. So we follow given definition.
Thus answer: code in Python.
But perhaps the user wants the code to be in a specific language? The user didn't specify, so we can choose a language and state that we are writing in Python. The instruction "Write a program which prints ..." we respond with code.
We should also maybe explain the approach? Usually, the answer includes code. But in this environment, we should output the program. The user may expect the final answer to be the code itself.
Thus final answer: Python code.
But also note: The problem constraints n up to 44, so we could also use recursion with memoization, but iterative is simpler.
I'll provide a short code.
Maybe the platform expects to read from standard input and output exactly the number.
I'll output:
python
import sys
def main():
n = int(sys.stdin.readline())
a, b = 1, 1
for i in range(2, n+1):
a, b = b, a + b
print(b)
if __name__ == "__main__":
main()
Alternatively, we can avoid function and just:
n = int(input())
a,b=1,1
for _ in range(2,n+1): a,b=b,a+b
print(b)
I think the simpler is fine.
I'll respond with code. ```python
import sys
def main():
n = int(sys.stdin.readline())
a, b = 1, 1
for _ in range(2, n + 1):
a, b = b, a + b
print(b)