Round to 25, 50, 75, 100

后端 未结 5 1950
说谎
说谎 2021-01-28 03:49

I\'m not a Math person so I\'m having a hard time to come up with a calculation to round the decimals to 25, 50, 75 and 100. And this will not be the typical round off because t

5条回答
  •  天涯浪人
    2021-01-28 04:05

    public float RoundNearestCents(double d)
    {
      return (double)(Math.Ceiling(d * 4)) / 4;
    }
    

提交回复
热议问题