views:

275

answers:

3
int a = 10000000;
a.ToString();

How do I make the output?

10,000,000

+2  A: 

a.ToString("N0")

See also: Standard Numeric Formatting Strings from MSDN

lc
A: 

a.tostring("00,000,000")

Mike
I think you took the // literally I think the OP was meaning to write it as commented code.
bendewey
you could try a = "10,000,000" ;)
johnc
+7  A: 

Try N0 for no decimal part:

string formatted = a.ToString("N0"); // 10,000,000
CMS