Decimal.Truncate() Method in C# Last Updated : 17 Feb, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report This method is used to get the integral digits of the specified Decimal by discarding any fractional digits. This method rounds the specified value to the nearest whole number by removing the digits after the decimal point. Syntax: public static decimal Truncate (decimal d); Here, d is the decimal number which is to be truncated. Return Value: It returns the result of d rounded toward zero, to the nearest whole number. Example: csharp // C# program to demonstrate the // Decimal.Truncate(Decimal) Method using System; class GFG { // Main Method public static void Main() { try { // Taking decimal variables // having fractional part Decimal dec1 = 214748.78549M; Decimal dec2 = 21458565.2996m; // using Decimal.Truncate(Decimal) Method Decimal val1 = Decimal.Truncate(dec1); // using Decimal.Truncate(Decimal) Method Decimal val2 = Decimal.Truncate(dec2); // Printing the Integral part only Console.WriteLine("The integral part of "+ "dec1 is: {0}", val1); Console.WriteLine("The integral part of "+ "dec2 is: {0}", val2); } catch (OverflowException e) { Console.Write("Exception Thrown: "); Console.Write("{0}", e.GetType(), e.Message); } } } Output: The integral part of dec1 is: 214748 The integral part of dec2 is: 21458565 Reference: https://docs.microsoft.com/en-us/dotnet/api/system.decimal.truncate?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article Decimal.Truncate() Method in C# K Kirti_Mangal Follow Improve Article Tags : C# CSharp-method CSharp-Decimal-Struct Similar Reads Decimal.Subtract() Method in C# This method is used to subtract the one specified Decimal value from another. Syntax: public static decimal Subtract (decimal a1, decimal a2); Parameters: a1: This parameter specifies the minuend. a2: This parameter specifies the subtrahend. Return Value: Result of subtracting a2 from a1. Exceptions 2 min read Decimal.ToUInt32() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 32-bit unsigned integer. A user can also convert a Decimal value to a 32-bit unsigned integer by using the Explicit assignment operator. Syntax: public static uint ToUInt32 (decimal d); Here, the d is the decimal num 2 min read Decimal.ToUInt16() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 16-bit unsigned integer. A user can also convert a Decimal value to a 16-bit unsigned integer by using the Explicit assignment operator. Syntax: public static ushort ToUInt16 (decimal value); Here, the value is the d 2 min read Decimal.ToUInt64() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 64-bit unsigned integer. A user can also convert a Decimal value to a 64-bit unsigned integer by using the Explicit assignment operator. Syntax: public static ulong ToUInt64 (decimal d); Here, the d is the decimal nu 2 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