Commit | Line | Data |
---|---|---|
970ed795 | 1 | /****************************************************************************** |
3abe9331 | 2 | * Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
3 | * All rights reserved. This program and the accompanying materials |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | ******************************************************************************/ | |
8 | module Fibonacci { | |
9 | ||
10 | const integer NTIMES := 10, NUMBER := 30; | |
11 | ||
12 | /* another recursive little rascal */ | |
13 | function fib(in integer x) return integer | |
14 | { | |
15 | if (x > 2) { | |
16 | return (fib(x-1)+fib(x-2)); | |
17 | } else { | |
18 | return (1); | |
19 | } | |
20 | } | |
21 | ||
22 | control | |
23 | { | |
24 | var integer i, v; | |
25 | ||
26 | for (i := 1; i <= NTIMES; i := i + 1) | |
27 | { | |
28 | v := fib(NUMBER); | |
29 | } | |
30 | ||
31 | // temp = fib(value); | |
32 | } | |
33 | } |