Decimal.Ceiling() Method in C# Last Updated : 29 Jan, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report This method is used to round the decimal to the closest integer toward positive infinity. Syntax: public static decimal Ceiling (decimal d); Here d is the decimal whose ceiling value is to be calculated. Return Value: It 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. Below programs illustrate the use of Decimal.Ceiling(Decimal) Method: Example 1: csharp // C# program to demonstrate the // Decimal.Ceiling(Decimal) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring the decimal variable Decimal a = 4.01m; // finding the ceiling of // the Decimal value // using ceiling() method; Decimal value = Decimal.Ceiling(a); // Display the ceiling Console.WriteLine("Ceiling Value is : {0}", value); } } Output: Ceiling Value is : 5 Example 2: csharp // C# program to demonstrate the // Decimal.Ceiling(Decimal) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring the decimal variable Decimal a = -5.03m; // finding the Ceiling of // the Decimal value // using Ceiling() method; Decimal value = Decimal.Ceiling(a); // Display the Ceiling Console.WriteLine("Ceiling Value is : {0}", value); } } Output: Ceiling Value is : -5 Example 3: csharp // C# program to demonstrate the // Decimal.Ceiling(Decimal) Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring the decimal variable Decimal a = 2.00m; // finding the Ceiling of // the Decimal value // using Ceiling() method; Decimal value = Decimal.Ceiling(a); // Display the Ceiling Console.WriteLine("Ceiling Value is : {0}", value); } } Output: Ceiling Value is : 2 Comment More infoAdvertise with us Next Article Decimal.Add() Method in C# I IshwarGupta Follow Improve Article Tags : C# CSharp-method CSharp-Decimal-Struct Similar Reads Decimal.Compare() Method in C# This method is used to compare two specified Decimal values. Syntax: public static int Compare (decimal a1, decimal a2); Parameters: a1:This parameter specifies the first value to compare. a2:This parameter specifies the second value to compare. Return Value: It returns a signed number indicating th 2 min read Decimal.Add() Method in C# This method is used to add two specified decimal values. Syntax: public static decimal Add (decimal a1, decimal a2); Parameters: a1: This parameter specifies the first value to add. a2: This parameter specifies the second value to add. Return Value: Decimal sum of a1 & a2. Exceptions: This metho 2 min read Decimal.Floor() Method in C# This method is used to round the decimal to the closest integer toward negative infinity. Syntax: public static decimal Floor (decimal d); Parameter: d: This parameter specifies the decimal which will be rounded off. Return Value: If d has a fractional part, the next whole Decimal number toward nega 2 min read Decimal.Divide() Method in C# This method is used to divide the two specified decimal values. Syntax: public static decimal Divide (decimal a1, decimal a2); Parameters: a1: This parameter specifies the dividend. a2: This parameter specifies the divisor. Return Value: The result of dividing a1 by a2. Exceptions: DivideByZeroExcep 2 min read MathF.Ceiling() Method in C# with Examples In C#, MathF.Ceiling(Single) is a MathF class method. This method is used to find the smallest integer , which is greater than or equal to the specified single or float value in the argument list. Syntax: public static float Ceiling (float x); Here, x is the float(Single) value whose ceiling value h 1 min read Decimal.ToSByte() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 8-bit signed integer. A user can also convert a Decimal value to an 8-bit integer by using the Explicit assignment operator. Syntax: public static sbyte ToSByte (decimal value); Here, the value is the decimal number 2 min read Like