aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-001/abigail/README.md2
-rw-r--r--challenge-001/abigail/pascal/ch-1.p26
-rw-r--r--challenge-001/abigail/pascal/ch-2.p33
3 files changed, 61 insertions, 0 deletions
diff --git a/challenge-001/abigail/README.md b/challenge-001/abigail/README.md
index b05494a4c2..255a84f136 100644
--- a/challenge-001/abigail/README.md
+++ b/challenge-001/abigail/README.md
@@ -20,6 +20,7 @@ count the number of time we encountered an 'e'.
* [Java](java/ch-1.java)
* [lua](lua/ch-1.lua)
* [Node.js](node/ch-1.js)
+* [Pascal](pascal/ch-1.p)
* [Perl](perl/ch-1.pl)
* [Python](python/ch-1.py)
* [Ruby](ruby/ch-1.rb)
@@ -46,6 +47,7 @@ upper boad from STDIN.
* [Java](java/ch-2.java)
* [lua](lua/ch-2.lua)
* [Node.js](node/ch-2.js)
+* [Pascal](pascal/ch-2.p)
* [Perl](perl/ch-2.pl)
* [Python](python/ch-2.py)
* [Ruby](ruby/ch-2.rb)
diff --git a/challenge-001/abigail/pascal/ch-1.p b/challenge-001/abigail/pascal/ch-1.p
new file mode 100644
index 0000000000..c473adc559
--- /dev/null
+++ b/challenge-001/abigail/pascal/ch-1.p
@@ -0,0 +1,26 @@
+Program ch1;
+
+(* *)
+(* See https://theweeklychallenge.org/blog/perl-weekly-challenge-001 *)
+(* *)
+
+(* *)
+(* Run as: fpc -och-1.out ch-1.p; ./ch-1.out < input-file *)
+(* *)
+
+uses
+ StrUtils, SysUtils;
+
+var
+ line: string;
+ count: LongInt;
+
+begin
+ while not eof do begin
+ readln (line);
+ count := 0;
+ line := StringReplace (line, 'e', 'E', [rfReplaceAll], count);
+ writeln (line);
+ writeln (count);
+ end
+end.
diff --git a/challenge-001/abigail/pascal/ch-2.p b/challenge-001/abigail/pascal/ch-2.p
new file mode 100644
index 0000000000..67ae90bc30
--- /dev/null
+++ b/challenge-001/abigail/pascal/ch-2.p
@@ -0,0 +1,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.