#C7474. Fibonacci Sequence Calculator

    ID: 51349 Type: Default 1000ms 256MiB

Fibonacci Sequence Calculator

Fibonacci Sequence Calculator

Given a non-negative integer \( n \), calculate the \( n \)th Fibonacci number. The Fibonacci sequence is defined as follows:

\( F(0)=0, \ F(1)=1 \), and for all \( n \ge 2 \), \[ F(n)=F(n-1)+F(n-2) \]

If \( n \) is negative, your program should output Input must be a positive integer.

Examples:

  • Input: 0 → Output: 0
  • Input: 10 → Output: 55
  • Input: -5 → Output: Input must be a positive integer.

inputFormat

A single integer ( n ) is provided via standard input.

outputFormat

Print the ( n )th Fibonacci number to standard output. If ( n ) is negative, print "Input must be a positive integer.".## sample

0
0