Round down a number
using System; using System.Data; using System.Text.RegularExpressions; class Class1{ static void Main(string[] args){ Console.WriteLine(RoundDown(.4)); Console.WriteLine(RoundDown(.5)); Console.WriteLine(RoundDown(.6)); Console.WriteLine(RoundDown(1.4)); Console.WriteLine(RoundDown(1.5)); Console.WriteLine(RoundDown(1.6)); Console.WriteLine(RoundDown(2.4)); Console.WriteLine(RoundDown(2.5)); Console.WriteLine(RoundDown(2.6)); Console.WriteLine(RoundDown(3.4)); Console.WriteLine(RoundDown(3.5)); Console.WriteLine(RoundDown(3.6)); } public static double RoundDown(double valueToRound) { double floorValue = Math.Floor(valueToRound); if ((valueToRound - floorValue) > .5) { return (floorValue + 1); } else { return (floorValue); } } }