You are getting 0 because of how you are using the numbers. You are using Integers
. Do this:
<%= target = (Float(10)/Float(20))/100 %>
Using floats will allow you to get the percentage you are using. When you use Integers, it will generally round the number off. Hope this helps.
EDIT:
You can also use the .to_f
method as well, instead of Float