Rounds a Decimal value to a specified number of decimal places.
using System;
class MainClass
{
public static void ShowDecimalRound( decimal Argument, int Digits )
{
decimal rounded = decimal.Round( Argument, Digits );
Console.WriteLine( "{0,26}{1,8}{2,26}", Argument, Digits, rounded );
}
public static void Main( )
{
ShowDecimalRound( 1.45M, 1 );
}
}
Related examples in the same category