1
$\begingroup$

I'm studying the APL language and doing the exercises here: One of the questions is:

b) Add 15% to each number in the list 14 5 78 145.

I tried this:

14 5 78 145 + (14 × 15 ÷ 100) (5 × 15 ÷ 100) (78 × 15 ÷ 100) (145 × 15 ÷ 100)

I get the correct results but this is ugly since I had to write each number. The better answer is given as:

14 5 78 145 × 1.15

I could not figure out how they got 1.15? How can 1.15 work for each different number? Can you help?

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Given a number N the $15\%$ of that number is given by

$$\frac{15}{100}\times N=0.15\times N$$

then

$$N+0.15\times N=1.15 \times N$$

$\endgroup$
4
  • $\begingroup$ So for N=5, do we do this? 5/5 + (0.15 * 5) / 5 = (1.15 * 5) / 5 $\endgroup$
    – zeynel
    Commented Oct 17, 2018 at 20:23
  • $\begingroup$ @zeynel For $N=5$ we have $5+5*0.15=5+0.75=5.75$. $\endgroup$
    – user
    Commented Oct 17, 2018 at 20:25
  • $\begingroup$ how do we get 1 in 1.15? That's what I don't understand. $\endgroup$
    – zeynel
    Commented Oct 17, 2018 at 20:36
  • $\begingroup$ @zeynel: “Add 15% to N” means “calculate N + (15% of N)”. The 1 in 1.15 comes from the first N in “N + (15% of N)”. To see that, $ N + (\text{15% of} N) = N + \frac {15} {100} × N = 1 × N + 0.15×N = (1 + 0.15)×N = 1.15×N $. $\endgroup$
    – PJTraill
    Commented Oct 25, 2018 at 14:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .