fn fib(n: i32) -> i32 {
if n <= 1 {
return n;
}
return fib(n - 1) + fib(n - 2);
}
fn main() {
println!("{}", fib(10));
}
Output
55
fn fib(n: i32) -> i32 {
if n <= 1 {
return n;
}
return fib(n - 1) + fib(n - 2);
}
fn main() {
println!("{}", fib(10));
}
55