The Ada Program: golden.adb
1 -- golden.adb: compute Golden number for 1997 and several integer constants
2
3 with Ada.Text_IO, Ada.Integer_Text_IO;
4 use Ada;
5
6 procedure Golden is
7
8 Year : constant Integer := 1997;
9 Golden : constant Integer := (Year rem 19) + 1;
10 Century : constant Integer := (Year / 100) + 1;
11 Clavian : constant Integer := ((8*Century + 5) / 25) - 5;
12 Gregorian: constant Integer := (3*Century / 4) - 12;
13 Extra : constant Integer := (5*Year / 4) - Gregorian - 10;
14
15 begin
16
17 Text_IO.Put ("So-called ""Golden number"" in the 19-year Metonic cycle:");
18 Integer_Text_IO.Put (Golden);
19 Text_IO.New_Line;
20
21 Text_IO.Put ("Extra:");
22 Integer_Text_IO.Put (Extra);
23 Text_IO.New_Line;
24
25 end Golden;