fn fib(n: i32) -> i32 {
    if n < 1 {
        return 0;
    } else if n < 3 {
        return 1;
    } else {
        return fib(n - 1) + fib(n - 2);
    }
}
fn main() {    
    for n in 1..11 {
        println!("fib({})={}", n, fib(n));
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: