git @ Cat's Eye Technologies The-Dipple / c6f0507
Add Oberon-07 program that outputs the first 30 Fibonacci numbers. Chris Pressey 3 years ago
1 changed file(s) with 32 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 (*
1 Using Vostok Oberon-07 implementation ( https://github.com/Vostok-space/vostok )
2 Run with:
3 ./result/ost run 'Fibonacci.FibThirty' -infr . -m source -m ~/path/to/Dipple/oberon/
4 *)
5
6 MODULE Fibonacci;
7
8 IMPORT Out;
9
10 PROCEDURE Fib(count: INTEGER);
11 VAR a, b, c, i: INTEGER;
12 BEGIN
13 a := 1;
14 b := 1;
15 Out.Int(a, 0); Out.Ln;
16 Out.Int(b, 0); Out.Ln;
17 FOR i := 1 TO count DO
18 c := a + b;
19 Out.Int(c, 0); Out.Ln;
20 a := b;
21 b := c;
22 END;
23 END Fib;
24
25 PROCEDURE FibThirty*;
26 BEGIN
27 Fib(30);
28 END FibThirty;
29
30 BEGIN
31 END Fibonacci.