Decimal.Floor() Method in C# Last Updated : 29 Jan, 2019 Comments Improve Suggest changes Like Article Like Report 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 negative infinity that is less than d or d doesn't have a fractional part, d is returned unchanged. Note that the method returns an integral value of type Decimal. Below programs illustrate the use of Decimal.Floor(Decimal) Method: Example 1: csharp // C# program to demonstrate the // Decimal.Floor(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 floor of the Decimal value // using floor() method; Decimal value = Decimal.Floor(a); // Display the Floor Console.WriteLine("Floor Value is : {0}", value); } } Output: Floor Value is : 4 Example 2: csharp // C# program to demonstrate the // Decimal.Floor(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 floor of the Decimal value // using floor() method; Decimal value = Decimal.Floor(a); // Display the Floor Console.WriteLine("Floor Value is : {0}", value); } } Output: Floor Value is : -6 Example 3: csharp // C# program to demonstrate the // Decimal.Floor(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 floor of // the Decimal value // using floor() method; Decimal value = Decimal.Floor(a); // Display the Floor Console.WriteLine("Floor Value is : {0}", value); } } Output: Floor Value is : 2 Comment More infoAdvertise with us Next Article Decimal.Floor() Method in C# I IshwarGupta Follow Improve Article Tags : C# CSharp-method CSharp-Decimal-Struct Similar Reads 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.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 Decimal.GetBits() Method in C# Decimal.GetBits() Method is used to convert the value of a specified instance of Decimal to its equivalent binary representation. Syntax: public static int[] GetBits (decimal d); Here, it takes the floating point value to convert. Return Value: This method returns a 32-bit signed integer array with 2 min read Decimal.Ceiling() Method in C# 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 para 2 min read 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 Like