diff options
| author | Abigail <abigail@abigail.be> | 2021-05-11 19:59:10 +0200 |
|---|---|---|
| committer | Abigail <abigail@abigail.be> | 2021-05-11 19:59:10 +0200 |
| commit | 962c17a7075cedbd4b75e894cd40e06ebb33da69 (patch) | |
| tree | d2b0954d79c9c4ba2be296f2e6d5b7228770a022 /challenge-112/abigail | |
| parent | d498fd3ea3e1df8c647b83e5e4922e6af971960b (diff) | |
| download | perlweeklychallenge-club-962c17a7075cedbd4b75e894cd40e06ebb33da69.tar.gz perlweeklychallenge-club-962c17a7075cedbd4b75e894cd40e06ebb33da69.tar.bz2 perlweeklychallenge-club-962c17a7075cedbd4b75e894cd40e06ebb33da69.zip | |
Pascal solution for week 112, part 2
Diffstat (limited to 'challenge-112/abigail')
| -rw-r--r-- | challenge-112/abigail/README.md | 1 | ||||
| -rw-r--r-- | challenge-112/abigail/pascal/ch-2.p | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/challenge-112/abigail/README.md b/challenge-112/abigail/README.md index 2b454118bb..6fae38d608 100644 --- a/challenge-112/abigail/README.md +++ b/challenge-112/abigail/README.md @@ -62,6 +62,7 @@ This is just finding the `$n + 1` Fibonacci number. * [Lua](lua/ch-2.lua) * [Node.js](node/ch-1.js) * [Perl](perl/ch-2.pl) +* [Pascal](pascal/ch-2.p) * [Python](python/ch-2.py) * [Ruby](ruby/ch-1.rb) diff --git a/challenge-112/abigail/pascal/ch-2.p b/challenge-112/abigail/pascal/ch-2.p new file mode 100644 index 0000000000..40c2427265 --- /dev/null +++ b/challenge-112/abigail/pascal/ch-2.p @@ -0,0 +1,26 @@ +Program StairCase; + +(* *) +(* See ../README.md *) +(* *) + +(* *) +(* Run as: fpc -och-2.out ch-2.p; ./ch-2.out < input-file *) +(* *) + +uses math; + +const + sqrt5 = sqrt (5); + phi = (1 + sqrt5) / 2; + +var + n: integer; + +begin + while not eof () do + begin + readln (n); + writeln (round (power (phi, n + 1) / sqrt5)); + end +end. |
