bench-fibo

Unnamed repository; edit this file 'description' to name the repository.
git clone https://logand.com/git/bench-fibo.git/
Log | Files | Refs | README

ofibo40.m (323B)


      1 #import <objc/Object.h>
      2 
      3 @interface Fibo : Object
      4 - (int) fibo: (int) n;
      5 @end
      6 
      7 //-------------
      8 
      9 #include <stdio.h>
     10 
     11 @implementation Fibo
     12 - (int) fibo: (int) n {
     13   if(n < 3) return n;
     14   else return [self fibo: n - 1] + [self fibo: n - 2];
     15 }
     16 @end
     17 
     18 int main() {
     19   printf("%d\n", [[[Fibo alloc] init] fibo: 40]);
     20   return 0;
     21 }