Advertisement
sissou123

Untitled

Mar 16th, 2022
1,173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. JavaScript Algorithms and Data Structures
  2. Basic JavaScript
  3. Finding a Remainder in JavaScript
  4. The remainder operator % gives the remainder of the division of two numbers.
  5.  
  6. Example
  7.  
  8. 5 % 2 = 1 because
  9. Math.floor(5 / 2) = 2 (Quotient)
  10. 2 * 2 = 4
  11. 5 - 4 = 1 (Remainder)
  12. Usage
  13. In mathematics, a number can be checked to be even or odd by checking the remainder of the division of the number by 2.
  14.  
  15. 17 % 2 = 1 (17 is Odd)
  16. 48 % 2 = 0 (48 is Even)
  17. for more:http://besturl.link/yANpT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement