diff options
Diffstat (limited to 'challenge-073/duncan-c-white/README')
| -rw-r--r-- | challenge-073/duncan-c-white/README | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/challenge-073/duncan-c-white/README b/challenge-073/duncan-c-white/README new file mode 100644 index 0000000000..8f0971a5c6 --- /dev/null +++ b/challenge-073/duncan-c-white/README @@ -0,0 +1,58 @@ +Task 1: "Trailing Zeroes + +You are given a positive integer $N (<= 10). + +Write a script to print number of trailing zeroes in $N!. + +Example 1 +Input: $N = 10 +Output: 2 as $N! = 3628800 has 2 trailing zeroes + +Example 2 +Input: $N = 7 +Output: 1 as $N! = 5040 has 1 trailing zero + +Example 3 +Input: $N = 4 +Output: 0 as $N! = 24 has 0 trailing zero + +" + +My notes: ok. Very easy. fact and "while mod 10 == 0 inc & div 10" +See also ch-1a.pl, which TABULATES n, n! and trailing-zeroes(n!).. + +Task 2: "Lines Range + +You are given a text file name $file and range $A - $B where $A <= $B. + +Write a script to display lines range $A and $B in the given file. +Example +Input: + + $ cat input.txt + L1 + L2 + L3 + L4 + ... + ... + ... + ... + L100 + +$A = 4 and $B = 12 + +Output: + + L4 + L5 + L6 + L7 + L8 + L9 + L10 + L11 + L12 +" + +My notes: ok. Seems even easier. I/O and a line number count (let's use $.) |
