// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; class MainClass { public static double MyRound(double x) { return Math.Floor(x + 0.5); } public static void Main(string[] args) { Console.WriteLine(Math.Round(0.5) + " " + MyRound(0.5)); Console.WriteLine(Math.Round(1.5) + " " + MyRound(1.5)); Console.WriteLine(Math.Round(2.5) + " " + MyRound(2.5)); Console.WriteLine(Math.Round(3.5) + " " + MyRound(3.5)); Console.WriteLine(Math.Round(4.5) + " " + MyRound(4.5)); Console.WriteLine(Math.Round(5.5) + " " + MyRound(5.5)); Console.WriteLine(MyRound(0.49999)); Console.WriteLine(MyRound(0.5)); Console.WriteLine(MyRound(0.50001)); } }