Round decimal to Ceiling in CSharp

Description

The following code shows how to round decimal to Ceiling.

Example


/* ww w .  j a  va  2 s. co m*/
using System;

class DecCompareEqualsDemo
{
    public static void Main( )
    {    
        decimal[] values = {12.6m, 12.1m, 5.5m, 8.56m, .1m, -5.1m, -5.9m};
        foreach (decimal value in values)
           Console.WriteLine("{0} -> {1}", value, Decimal.Ceiling(value));
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var