This is my first year teaching an AP course, and I must admit that I have never heard of n mod n or n % n. I have searched and struggled to find why 2 % 3 is 2 and why 2 % 4 is 2. Not being a math person, I thought that you couldn’t divide 2 by a larger number. There is no remainder! Please help.
Code from U7 L3 level 9 example solution:
// Make sure students are understanding the concept of how %
// is tied to the remainder
// Example
console.log(5%2);
console.log(1);
console.log("");
// console.log your answer - check that the two lines match in the console
console.log(2%3);
console.log(2);
console.log("");
// console.log your answer - check that the two lines match in the console
console.log(10%2);
console.log(0);
console.log("");
// console.log your answer - check that the two lines match in the console
console.log(2%4);
console.log(2);
console.log("");
// console.log your answer - check that the two lines match in the console
console.log(7%1);
console.log(0);
console.log("");