Advertisement
imjyb1008work

Math.Round

Sep 8th, 2018
1,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.24 KB | None | 0 0
  1. decimal input = 94.8725M; //傳給Round的第一個參數一定要用decimal,不可以使用flot或是double
  2. decimal output = Math.Round(input, 3, MidpointRounding.AwayFromZero);
  3. Console.WriteLine(output);
  4.  
  5. //input  94.8725
  6. //output 94.873
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement