计算两个数字之间的比率(拇指向上/向下评级)

What is the mathematical solution/algorithm for thumbs up/down rating system? I want to display the rating like the one we usually see on the tube sites like:

Thumbs up btn | Ratings here | Thumbs down btn

but i'm not sure what calculation to use. I tried the:

Thumbsup / Thumbsdown * 100 but it gives me result morethan 100%.

Example: 6/2*100 = 300

Assuming you have some thumbsup or some thumbsdown (if not then displaying a percentage would make no sense)

For the percentage Thumbs up:

Thumbsup / (Thumbsup + Thumbsdown) * 100

So in your example

6/(6+2) * 100 = 75%

And likewise with Thumbsdown as the numerator for the percentage thumbs down

thumbsUp / (thumbsUp + thumbsDown) * 100 gives the ratio for thumbs up.

thumbsDown / (thumbsUp + thumbsDown) * 100 gives the ratio for thumbs down.