decimal on c# code example Example 1: Decimal Number Variable C# float number = 8.1f; Example 2: decimal places c# decimalVar.ToString("F");