0

trying to write code for a function using dollar amounts with an operation only want 2 decimal places to show on output

21st Jul 2016, 3:26 PM
Kenneth Welch
Kenneth Welch - avatar
4 Answers
0
Get a look to this page. It should solve your problem. https://msdn.microsoft.com/en-us/library/dwhawy9k(v=vs.110).aspx
22nd Jul 2016, 1:41 AM
Idril
Idril - avatar
0
will do thx
22nd Jul 2016, 1:43 AM
Kenneth Welch
Kenneth Welch - avatar
0
decimal account = 1500.955M; Console.WriteLine("{0}", account.ToString("C2")); And please use decimal for currency calculations because it's based by 10 not by 2. It has some advantages.
22nd Jul 2016, 2:14 AM
Idril
Idril - avatar
0
also multiplying it by a double decimal for a percentage
22nd Jul 2016, 2:18 AM
Kenneth Welch
Kenneth Welch - avatar