What does Console.WriteLine(Math.Round(2.5)); print in C#?
Correct answer A. 2
Math.Round with no mode uses MidpointRounding.ToEven, also called banker's rounding: a value exactly halfway between two integers goes to the even one. So 2.5 rounds to 2 and 3.5 rounds to 4. This reduces bias when many values are rounded. To get school-style rounding, call Math.Round(2.5, MidpointRounding.AwayFromZero), which returns 3.
Answer checked How we write and check questions
Discussion