Calaulate percenatge from amount in ruby

HI,
How to get 50% percentage value from some amount.
For example i have maxscore = 2.789
I want to calculate 50%(its dynamic it’s may vary like 40% etc…) value
from maxscore.Is there any ruby methods

Yes, multiplication.

score = max_score * 0.5

2012/1/22, Lucky Nl [email protected]:

On Sun, Jan 22, 2012 at 09:00, Lucky Nl [email protected] wrote:

How to get 50% percentage value from some amount.
For example i have maxscore = 2.789
I want to calculate 50%(its dynamic it’s may vary like 40% etc…) value
from maxscore.Is there any ruby methods

That’s just simple math. Think about what “percent” means. If you
really want a method that returns, say, X percent of Y, try writing it
yourself and let us know if you have problems.

-Dave