Saturday, January 14, 2012

How do I calculate a percentage from two numbers (fraction)?

So, I have an issue where I have two possible values, a win and a loss.

Let's say I have 4 wins and 2 losses. I want to calculate the percentage of wins out of the combination of wins and losses. The issue is, I need to put this into something of an algorithm for a program. So I need a way to implement converting 4 wins and 2 losses into a percentage of wins and a percentage of losses, and I need to see its implementation in a formula.

Could anyone help me out?How do I calculate a percentage from two numbers (fraction)?
add the wins and losses to get total outcomes.

divide the wins by total outcomes and multiply by 100 to get percent wins.

same for lossesHow do I calculate a percentage from two numbers (fraction)?
if you input wins "W" and losses "L" then the percentage of wins is W / (W+L) and the percentage of losses is L / (W+L) or 100 - percent wins; however you want to do itHow do I calculate a percentage from two numbers (fraction)?
input w

input l



t = w + l

w% = w/t

l% = l/t



print, "winning percentage is "; w%

print, "losing percentage is ": l%



end

No comments:

Post a Comment