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
  • 42,799
  • 6
  • 22
  • 44
SH093
  • 27
  • 6
  • https://docs.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://docs.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated

Joel Coehoorn
  • 380,066
  • 110
  • 546
  • 781