#C13606. Fibonacci Numbers Computation
Fibonacci Numbers Computation
Fibonacci Numbers Computation
This problem requires you to compute the nth Fibonacci number by implementing an iterative method. The Fibonacci sequence is defined as follows:
$$F(0)=0,\ F(1)=1,\ F(n)=F(n-1)+F(n-2) \text{ for } n\ge2$$
Your program should read an integer n from standard input and output the nth Fibonacci number to standard output. If the input is a negative number, the program should output the error message "Input cannot be negative".
inputFormat
The input consists of a single integer n provided via standard input. It is guaranteed that when n is non-negative, it falls within a reasonable range (for example, 0 ≤ n ≤ 40). When n is negative, your program must handle it appropriately.
outputFormat
If the input n is non-negative, output a single integer representing the nth Fibonacci number. If the input is negative, output the exact error message "Input cannot be negative".
## sample0
0