A bit of math logic please

C

catherine

Hi, basically I need a function which will return a number for...

Given a number n (Say 800px) by what factor do I need to shrink it to
get it as close to but not over 300px?

Bear in mind that the number n may be 301px or 1638px

Thanks for any help!
Kate
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Hi, basically I need a function which will return a number for...

Given a number n (Say 800px) by what factor do I need to shrink it to
get it as close to but not over 300px?

Bear in mind that the number n may be 301px or 1638px

That's not a number. Lets work with numbers.

The factor is simply 300/n.

300/800 = 0.375

800 * 0.375 = 300
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top