Question: To round off the integer i to the next largest even multiple of another integer j, the formula next_multiple - i + j - i

To round off the integer i to the next largest even multiple of another integer j, the formula next_multiple - i + j - i % j can be used

In 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:

next_multiple = 256 + 7 - 256 % 7

= 256 + 7 - 4

= 259

Write a program in JavaScript to find the next largest even multiple for the following values of i and j:

i j
365 7
12.258 23
996 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!