freeCodeCamp/guide/russian/javascript/tutorials/finding-a-remainder-in-java.../index.md

23 lines
741 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
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)
```
**Примечание.** Не путайте его с одулем._ `%` Не работает с отрицательными числами.