diff options
| author | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-08-10 02:54:48 +0100 |
|---|---|---|
| committer | Mohammad S Anwar <mohammad.anwar@yahoo.com> | 2020-08-10 02:54:48 +0100 |
| commit | 82d56a626e16b0a7dceeba973b3c69e14031d7f9 (patch) | |
| tree | c741021456222e306f722bae737ad09dbd43fd6d /challenge-073/sgreen | |
| parent | 82dd9dbd3a76bf1b7a6e9902d2dd1897b22a88d9 (diff) | |
| download | perlweeklychallenge-club-82d56a626e16b0a7dceeba973b3c69e14031d7f9.tar.gz perlweeklychallenge-club-82d56a626e16b0a7dceeba973b3c69e14031d7f9.tar.bz2 perlweeklychallenge-club-82d56a626e16b0a7dceeba973b3c69e14031d7f9.zip | |
- Added template for Challenge #073.
Diffstat (limited to 'challenge-073/sgreen')
| -rw-r--r-- | challenge-073/sgreen/README.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/challenge-073/sgreen/README.md b/challenge-073/sgreen/README.md new file mode 100644 index 0000000000..6dec32d966 --- /dev/null +++ b/challenge-073/sgreen/README.md @@ -0,0 +1,39 @@ +# Perl Weekly Challenge 072 + +Solution by Simon Green. + +No solutions for last week as I was moving interstate. I'm back on board this week :) + +## TASK #1 › Trailing Zeroes + +When you think about it, a trailing zero is a product of 10, which is 2 × 5. Forgetting about the twos (since every second number is even), the five occurs every 5 numbers. Thus the factorial from 1 to 4 will contain no trailing zeros, 5-9 one trailing zero, 10-14 three trailing zeros, and so on. Once you reach 25, it gets a little more complicated as 25 is 5 × 5. Anyway, I digress from the actual task. + +For this task, I take the input, calculate the factorial value, I then use a regular expression to find the trailing zeros (if any), and then display it. + +### Examples + + » ./ch-1.pl 10 + 2 + + » ./ch-1.pl 7 + 1 + + » ./ch-1.pl 4 + 0 + +## TASK 2 › Lines Range + +This tasks was relatively simple. Read the file, skip the lines < `$A` and exit the loop once line `$B` is reached (or the end of file). + +## Example + + » ./ch-2.pl input.txt 4 12 + L4 + L5 + L6 + L7 + L8 + L9 + L10 + L11 + L12
\ No newline at end of file |
