Remark : 숫자 올림, 내림, 반올림.
올림 : (int)Math.Ceiling(number);
내림 : (int)Math.Truncate(number);
반올림 : (int)Math.Round(number);
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
static void Main(string[] args) { double number = 1.52; int Cumber = (int)Math.Ceiling(number); int Tumber = (int)Math.Truncate(number); int Rumber = (int)Math.Round(number); Console.WriteLine(Cumber); Console.WriteLine(Tumber); Console.WriteLine(Rumber); Console.ReadLine(); } |
1 2 3 4 5 |
2 1 2 |