PDA

View Full Version : keeping between the borders algorithm


umen
01-04-2003, 06:12 PM
hello folks
i need some idea for algorithm to solve me this problem :
say i have div with height = 400px
how i getting input say the number 900000 , and the number 11
the 2 numbers are random they can be 200 and 4 or what ever ...
now i need to find every time the right number to divide the first input number ( let say 900000 ...) so it will
divide equal with the second input number ( let say here 11 ) but will be between the border of 400 .
so it have to look something like this :
9000 / x =y
y * 11 = 400

hope you got my point
thanks

ez4me2c3d
01-04-2003, 06:41 PM
i think i might know what you are asking... you want to check to see if two randomly generated numbers meet two criteria.

1.) do they divide evenly
2.) is the quotient less than or equal to 400

if both are true then proceed, else, generate two new numbers.

is this correct? if so I'll write the code to accomplish this