Solution

  1. fn fib(n: u32) -> u32 {
  2.     if n < 2 {
  3.         return n;
  4.     } else {
  5.         return fib(n - 1) + fib(n - 2);
  6.     }
  7. }
  8. fn main() {
  9.     let n = 20;
  10.     println!("fib({n}) = {}", fib(n));
  11. }