source:
trunk/Softwares/Basic_test/src/c/func_fibonnacci.c
@
106
Last change on this file since 106 was 81, checked in by , 17 years ago | |
---|---|
|
|
File size: 225 bytes |
Line | |
---|---|
1 | #include "func_fibonnacci.h" |
2 | |
3 | int fibonnacci(int x) |
4 | { |
5 | int i; |
6 | int xn = 0; |
7 | int xn_1 = 1; |
8 | int xn_2 = 0; |
9 | |
10 | for (i=0;i<=x;i++) |
11 | { |
12 | xn = xn_1 + xn_2; |
13 | xn_2 = xn_1; |
14 | xn_1 = xn; |
15 | } |
16 | |
17 | return xn; |
18 | } |
Note: See TracBrowser
for help on using the repository browser.