If you want to cut a certain number of double decimal, C # offers a feature Math. Truncate () returns the corresponding amount.
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();
}
}
}
SPONSORS:
No comments:
Post a Comment