Decimal Functions in C#


The following are some of the decimal functions in C#.

Sr.No.Name & Description
1Add (Decimal, Decimal)
Adds two specified Decimal values.
2Ceiling(Decimal)


Returns the smallest integral value that is greater than or equal to the specified decimal number.
3Compare (Decimal, Decimal)
Compares two specified Decimal values.
4CompareTo(Decimal)
Compares this instance to a specified Decimal object and returns a comparison of their relative values.
5CompareTo(Object)
Compares this instance to a specified object and returns a comparison of their relative values.
6Divide (Decimal, Decimal)
Divides two specified Decimal values.
7Equals(Decimal)
Returns a value indicating whether this instance and a specified Decimal object represent the same value.

Let us see an example of Decimal Ceiling() method in C# that returns the smallest integral value greater than or equal to the specified decimal number.

Example

 Live Demo

using System;
class Program {
   static void Main() {
      Console.WriteLine(decimal.Ceiling(1.2M));
   }
}

Output

2

Updated on: 23-Jun-2020

173 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements