1

When I search in Google it shows me correct result $10\%9=1$

But in my calculator I get $10\%9=0.9$

Let me know the reason soon and if you have great solution that would be appreciated.

lioness99a
  • 4,943
Bala
  • 121
  • 4
  • 4
    I think your calculator may be interpreting % as "take the number after it, then convert it to a percentage", and then 10%9 is presumably "10 times 9 percent" which is indeed 0.9. – Ian Apr 24 '17 at 14:42
  • 2
    Short answer: % means different things to google and to a calculator. – Arthur Apr 24 '17 at 14:43
  • then which simpol i should choose in my calculator to find modulas – Bala Apr 24 '17 at 14:44
  • The meaning google (apparently) assigns to % is a function seldom found on calcuators. – Henrik supports the community Apr 24 '17 at 14:45
  • Some graphing calculators have a function remainder that you can give two arguments, in this case, remainder(10,9) would result in 1 –  Apr 24 '17 at 14:45

2 Answers2

3

Google (as well as a bunch of programming languages) interprets 10%9 as $10\mod 9$ and thus results in $1$.

a%n, or $a\mod n$, will have google find the $0\leq r<n$ such that there is an integer $k$ such that $kn+r=a$ (which is different than the usual $\text{mod}$, since those define equivalence classes, yet very similar).


Your calculator however assumes with a%n you mean "$a$ times $n$ percent" and will thus result in $a\cdot \frac{n}{100}$.
1

To compute $a\%n$ the way Google does, i.e. interpreting it as $a\mod n$, we can use the following formula:

$$a\%n=a\mod n=a - \left(\left\lfloor\frac an\right\rfloor \times n\right)$$

That is to say:

  1. Compute $\frac an$

  2. Round it down to the nearest integer

  3. Multipy it by $n$

  4. Subtract the result from the original $a$

For your example we would do:

\begin{align}10\%9&=10-\left(\left\lfloor\frac {10}{9}\right\rfloor \times 9\right)\\ &=10-\left(\left\lfloor1.\overline{111}\right\rfloor\times 9\right)\tag{Step $1$}\\ &=10-\left(1\times 9\right)\tag{Step $2$}\\ &=10-9\tag{Step $3$}\\ &=1\tag{Step $4$}\end{align}

lioness99a
  • 4,943