Fibby

Published 345d ago

 Rob

Generate fibs

fn fibonacci(n: u32) -> u32 {
    let mut a = 0;
    let mut b = 1;
    for _ in 0..n {
        let temp = a;
        a = b;
        b = temp + a;
    }
    a
}

fn main() {
    print!("{}", fibonacci(10));
}

Math
4

Please login or sign up to comment and collaborate