source: trunk/Softwares/Basic_test.or32/src/c/func_fibonnacci.c @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 225 bytes
Line 
1#include "func_fibonnacci.h"
2
3int 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.