-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfibonacci_columns.rs
27 lines (25 loc) · 1.52 KB
/
fibonacci_columns.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* /**/ #include <iostream> // */
/*/**/ uint32_t fibonacci(uint32_t n) // */ fn fibonacci(mut n: u32) -> u32
{
if (n < 2) { return n; }
/*/**/ uint32_t // */ let mut
f0 = 0;
/*/**/ uint32_t // */ let mut
f1 = 1;
/*/**/ uint32_t // */ let mut
temp = 0;
while (n > 1) {
temp = f1;
f1 = f0 + f1;
f0 = temp;
n = n - 1;
}
return f1;
}
/* /**/ int // */ fn
main() {
/* /**/ std::cout << // */ println!("{}",
fibonacci(10)
/* /**/ << std::endl // */ )
;
}