fn fib(n: u32) -> u32 {
if n == 0 { return 0; }
if n <= 2 { return 1; }
return fib(n - 1) + fib(n - 2);
}
fn main() {
for i in 0..11 {
println!("fib({}) = {}", i, fib(i));
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: