Mega Code Archive

 
Categories / C# / Development Class
 

Math Ceiling Returns the smallest integral value that is greater than or equal to the specified decimal number

using System; class Sample  {     public static void Main()      {         decimal[] values = {7.03m, 7.64m, 0.12m, -0.12m, -7.1m, -7.6m};         Console.WriteLine("  Value          Ceiling          Floor\n");         foreach (decimal value in values)            Console.WriteLine("{0,7} {1,16} {2,14}",                               value, Math.Ceiling(value), Math.Floor(value));     } }