Skip to content
Advertisement

Tag: math

Rounding to 0.05 taxes what am I doing wrong?

I’m super stuck on this problem and I don’t know where the math is going wrong. here goes.. Calculate the tax on these 2 products. tax should be rounded to the nearest 0.05. product_ONE price = $47.50 with a tax of 15%—answer should be $54.65; 47.50 * 15 / 100 = 7.125 7.125 / 0.05 = 142.5 -> rounded you

Closest divisible integer

Example. How can I find the integer c? The result of that example is c = 250. Answer There are two cases to consider: The closest integer that is less than or equal to a: The closest integer that is greater than a: Then we need to check which is closer to a and return that: So we could create

Find closest factor to a number, of a number

I am trying to automate the finding of the closest factor of a number to another number; Example: Closest factor of 700 to 30 is 28 (30 does not go into 700, but 28 does). An obvious solution is just to get all the factors of 700 and do a simple distance calculation to find the nearest factor to 30,

Calculate the date of Easter Sunday

Write a program to compute the date of Easter Sunday. Easter Sunday is the first Sunday after the first full moon of spring. Use the algorithm invented by the mathematician Carl Friedrich Gauss in 1800: Let y be the year (such as 1800 or 2001) Divide y by 19 and call the remainder a. Ignore the quotient. Divide y by

Advertisement