source: Deliverables/D2.1/Revision/benchmarks/fib.c @ 792

Last change on this file since 792 was 792, checked in by amadio, 9 years ago

Deliverable D2.1 with addendum

File size: 306 bytes
Line 
1
2/* Fibonacci function ran 100 times for values 10, 20 and 30 */
3
4
5int fib (int n) {
6  if (n < 2) return 1;
7  else return (fib (n-1) + fib (n-2));
8}
9
10int main () {
11  int i, res1, res2, res3;
12
13  for (i = 0 ; i < 100 ; i++) {
14    res1 = fib (10);
15    res2 = fib (20);
16    res3 = fib (30);
17  }
18
19  return 0;
20}
Note: See TracBrowser for help on using the repository browser.