Calculate percentage saved between two numbers?

前端 未结 9 1629
自闭症患者
自闭症患者 2020-12-22 19:25

I have two numbers, the first, is the original price, the second, is the discounted price.

I need to work out what percentage a user saves if they

9条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-22 20:02

    I know this is fairly old but I figured this was as good as any to put this. I found a post from yahoo with a good explanation:

    Let's say you have two numbers, 40 and 30.  
    
      30/40*100 = 75.
      So 30 is 75% of 40.  
    
      40/30*100 = 133. 
      So 40 is 133% of 30. 
    
    The percentage increase from 30 to 40 is:  
      (40-30)/30 * 100 = 33%  
    
    The percentage decrease from 40 to 30 is:
      (40-30)/40 * 100 = 25%. 
    
    These calculations hold true whatever your two numbers.
    

    Original Post

提交回复
热议问题