If you want to truncate a given decimal number of double number, C# provide a function Math.Truncate() to return corresponding number.
The below code provide sample demo application for the same.
C# Example Code to truncate a given number:
using System;
namespace DemoConsoleApplication
{
class Math_Truncate
{
static void Main(string[] args)
{
decimal dec_Number = 400.2222M;
decimal Result = Math.Truncate(dec_Number);
Console.WriteLine(" Truncated Number: " + Result);
Console.ReadLine();
}
}
}
0 comments:
Post a Comment