aboutsummaryrefslogtreecommitdiff
path: root/challenge-072/duncan-c-white/README
blob: 8f0971a5c625de2d7b44f0946483c92622bb9371 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 $.)