C# Decimal Ceiling

Description

Decimal Ceiling returns the smallest integral value that is greater than or equal to the specified decimal number.

Syntax

Decimal.Ceiling has the following syntax.


public static decimal Ceiling(
  decimal d
)

Parameters

Decimal.Ceiling has the following parameters.

  • d - A decimal number.

Returns

Decimal.Ceiling method returns The smallest integral value that is greater than or equal to the d parameter. Note that this method returns a Decimal instead of an integral type.

Example

The following example illustrates the Ceiling method.


/*  ww w  .j a v a  2  s . c o m*/
using System;

public class Example
{
   public static void Main()
   {
      Console.WriteLine(Decimal.Ceiling(-3.9m));
      Console.WriteLine(Decimal.Ceiling(3.9m));
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version