#C13729. Iterative Fibonacci Calculation
Iterative Fibonacci Calculation
Iterative Fibonacci Calculation
This problem requires you to implement an iterative approach to compute the nth Fibonacci number. The Fibonacci sequence is defined as follows:
\(F(0) = 0, \quad F(1) = 1\)
For \(n \ge 2\), the recurrence relation is given by:
\(F(n) = F(n-1) + F(n-2)\)
Your task is to calculate \(F(n)\) using a loop-based method which guarantees a time complexity of \(O(n)\) and a space complexity of \(O(1)\).
inputFormat
The input consists of a single integer \(n\) given via standard input (stdin). You can assume that \(0 \le n \le 90\) to avoid integer overflow issues.
outputFormat
Output the nth Fibonacci number to standard output (stdout).
## sample0
0
</p>