Fibonacci Number Calculation

# Introduction In this challenge, we will be working with Fibonacci numbers. The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the previous two numbers. Given a value `n`, our task is to calculate the `n`th Fibonacci number. For example, if `n` is 2, the output should be 1 because `F(2) = F(1) + F(0) = 1 + 0 = 1`. We need to implement a function `fib(n)` that takes an integer `n` as input and returns the `n`th Fibonacci number.

|
60 : 00

Click the virtual machine below to start practicing