0

I'm trying to make "totalSales" and "totalCommissions" into currency format with decimal points in the right spots. ($250,000.00) Something like this

Console.WriteLine("Totals: " + totalSales + " " + totalCommissions);
D-Shih
  • 44,943
  • 6
  • 31
  • 51
SH093
  • 27
  • 6
  • https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings -- have a look at format `"C"` – Ben Voigt Mar 25 '19 at 04:39

1 Answers1

1
Console.WriteLine($"Totals: {totalSales:C} {totalCommissions:C}");

Here's why it works:

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794