Possible Duplicate:
c# - How do I round a decimal value to 2 decimal places (for output on a page)
I have a number
long n = 32432432423;
I want to divide this by 1450 and print on a console with 2 decimal places (rounded)
How can I do it?
COnsole.WriteLine(????);
Just use %. 2f as the format specifier. This will make the Java printf format a double to two decimal places.
Console.WriteLine("{0:N2}", ((double)n) / 1450);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With