diff options
author | funemy | 2022-10-25 23:02:55 +0000 |
---|---|---|
committer | funemy | 2022-10-25 23:02:55 +0000 |
commit | 0a801e985fcb50d22acbe52a626d67d393c21851 (patch) | |
tree | c2464c31e16abb30c8f8623f6c335124b91fe149 /entries/jyoo980 | |
parent | 0269509a887fb154f32b88f5dfbeb883e16f628c (diff) | |
parent | e187bb84b9c3231f7f63a70a3136b7355ba0567a (diff) |
Merge branch 'main' of github.com:braxtonhall/fib
Diffstat (limited to 'entries/jyoo980')
-rw-r--r-- | entries/jyoo980/aspectj/Fibonacci.aj | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/entries/jyoo980/aspectj/Fibonacci.aj b/entries/jyoo980/aspectj/Fibonacci.aj new file mode 100644 index 0000000..39dfd8a --- /dev/null +++ b/entries/jyoo980/aspectj/Fibonacci.aj @@ -0,0 +1,21 @@ +public aspect Fibonnacci { + + pointcut mainInvocation(): call(* Main.*(*)); + + void before(): mainInvocation() { + // Nice + int n = 69; + System.out.println("The 69th fibonacci number is: " + fibonacci(n)); + } + + public int fibonacci(int n) { + int prev = 0; + int curr = 1; + for (int i = 0; i < n; i++) { + int tmp = prev; + prev = curr; + curr = prev + tmp; + } + return prev; + } +} |