Question: 2. Completing the previous exercise allowed you to discover Master Javas weakness. Master Javas armor can be weakened by an even multiple attack. However, to
2. Completing the previous exercise allowed you to discover Master Javas weakness. Master Javas armor can be weakened by an even multiple attack. However, to be effective, the numbers must only be even multiples of another integer. To round off, an integer i to the next largest even multiple of another integer j, the following formula can be used: nextMultiple = i + j - i % j For example, to round off 256 days to the next largest number of days evenly divisible by a week, values of i = 256 and j = 7 can be substituted into the preceding formula as follows: nextMultiple = 256 + 7 - 256 % 7
= 256 + 7 - 4
= 259
Write a program called multiples.js to find and display the next largest even multiple for the following values of i and j:
I j
356 7
12258 23
996 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
