Jake Hillion
7bf1b6600d
All checks were successful
continuous-integration/drone/push Build is passing
16 lines
250 B
Rust
16 lines
250 B
Rust
fn main() {
|
|
println!("fib(1) = {}", fib(1));
|
|
println!("fib(7) = {}", fib(7));
|
|
println!("fib(19) = {}", fib(19));
|
|
}
|
|
|
|
fn fib(i: u64) -> u64 {
|
|
let (mut a, mut b) = (0, 1);
|
|
|
|
for _ in 0..i {
|
|
(a, b) = (b, a + b);
|
|
}
|
|
|
|
a
|
|
}
|