Files
freeCodeCamp/guide/russian/javascript/tutorials/finding-a-remainder-in-javascript/index.md
2018-10-16 21:32:40 +05:30

23 lines
741 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Finding a Remainder in JavaScript
localeTitle: Поиск остатка в JavaScript
---
Оператор _остатка_ `%` дает остаток от деления двух чисел.
## пример
```
5 % 2 = 1 because
Math.floor(5 / 2) = 2 (Quotient)
2 * 2 = 4
5 - 4 = 1 (Remainder)
```
## использование
В математике число может быть проверено четным или нечетным, проверяя остаток от деления числа на 2.
```
17 % 2 = 1 (17 is Odd)
48 % 2 = 0 (48 is Even)
```
**Примечание.** Не путайте его с одулем._ `%` Не работает с отрицательными числами.