aboutsummaryrefslogtreecommitdiff
path: root/challenge-001/abigail/pascal/ch-2.p
blob: 67ae90bc30ccc6cfbe2cbda37fca568d20aced38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Program XXX;

(*                                                                   *)
(* See https://theweeklychallenge.org/blog/perl-weekly-challenge-001 *)
(*                                                                   *)

(*                                                        *)
(* Run as: fpc -och-2.out ch-2.p; ./ch-2.out < input-file *)
(*                                                        *)

var
    i, max: integer;

begin
    while not eof do begin
        readln (max);
        for i := 1 to max do begin
            if i mod 15 = 0 then begin
                writeln ('fizzbuzz');
                continue;
            end;
            if i mod  5 = 0 then begin
                writeln (    'buzz');
                continue;
            end;
            if i mod  3 = 0 then begin
                writeln ('fizz'    );
                continue;
            end;
            writeln (i);
        end
    end
end.