#C12321. Iterative Fibonacci Computation
Iterative Fibonacci Computation
Iterative Fibonacci Computation
Calculate the (n)th Fibonacci number using an iterative approach. The Fibonacci sequence is defined as (F_{0}=0, F_{1}=1) and for (n \ge 2), (F_{n} = F_{n-1} + F_{n-2}). If the input is a negative number, output the error message: "Fibonacci numbers are not defined for negative indices".
inputFormat
A single integer (n) provided via standard input (stdin).
outputFormat
A single integer representing the (n)th Fibonacci number printed to standard output (stdout), or an error message if (n < 0).## sample
0
0