C# Math Ceiling(Decimal)

Description

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

Syntax

Math.Ceiling(Decimal) has the following syntax.


public static decimal Ceiling(
  decimal d
)

Parameters

Math.Ceiling(Decimal) has the following parameters.

  • d - A decimal number.

Returns

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

Example

The following example illustrates the Math.Ceiling(Decimal) method and contrasts it with the Floor(Decimal) method.


using System;//w  w  w .  j  ava 2 s  .c  o m

public class MainClass{
  public static void Main(String[] argv){  
    Console.WriteLine(Math.Ceiling(1.2M));
  }
}
  

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