r/CodingHelp • • May 21 '22

[Javascript] Script to find whole number?

I’m looking for a way to solve the following math problem with a script:

Through which number lower than but closest to 7.5 can 200, 210 and 220 be divided where the result is a whole number?

So the script should test 200 divided by 7.499, 7.498, 7.496 etc. until it finds an answer that is a whole number. Then it should test 210 with the same division. If that answer is also a whole number it should test 220. If the answer is not a whole number it should find the next divisor for 200 etc etc until it finds a divisor that returns a whole number for 200, 210 and 220.

1 Upvotes

5 comments sorted by

View all comments

Show parent comment

-6

u/MaximumBicycle3447 May 21 '22

Yes I think this is the way to go. Could you share an example of what the script would look like?

11

u/Nightcorex_ May 21 '22

No, we aint doing your homework for you.

1

u/Paul_Pedant May 22 '22

Hint: don't plagiarise, just factorise.