c fibs (need to loop a lot to use time on it)
This commit is contained in:
parent
cd67589f3e
commit
140d33b167
29
test/bench/fibo.c
Normal file
29
test/bench/fibo.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include<stdio.h>
|
||||
|
||||
int fibo(int n){
|
||||
int result;
|
||||
int a = 0;
|
||||
int b = 1;
|
||||
int i = 1;
|
||||
while( i < n )
|
||||
{
|
||||
result = a + b;
|
||||
a = b;
|
||||
b = result;
|
||||
i++;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int counter = 1000000;
|
||||
int counter2 = counter;
|
||||
int level = 76;
|
||||
int fib ;
|
||||
while(counter--) {
|
||||
fib = fibo(level);
|
||||
}
|
||||
printf("%i times fib %d \n",counter2 , level);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user