using System; namespace HelloWorld { class Program { static void Main(string[] args) { decimal decimals = 34.99999M; double doubles = 34.99999; float floats = 34.99999F; string strings = "34.99999"; Console.WriteLine($"decimal類型的:{decimals:F2}"); Console.WriteLine($"double類型的:{doubles:F2}"); Console.WriteLine($"floats類型的:{floats:F2}"); Console.WriteLine($"string類型的:{strings:F2}");//string類型的不支持這樣寫。 Console.Read(); } } }