Maths Range To Percentage

后端 未结 3 896
离开以前
离开以前 2021-02-02 02:36

i need a bit of help with some maths.

I have a range 0 - 127 and i want to convert it into percentage.

So 0% = 0 and 100% = 127 and every number inbetween.

3条回答
  •  鱼传尺愫
    2021-02-02 03:03

    Generally, if you have numbers in the interval [a,b], to get the percentage inside your interval, the formula is:

    percentage = 100 * (x-a) / (b-a)  
    

    Where x is your value

提交回复
热议问题