c# - How to use String.Format specifier in an expression? -
double paintneeded = area/450;
when run above, output 0.444444444
, wanted 0.44
.
i tried this, throws error:
double paintneeded = string.format("{0:0.00}", (area/450)); console.writeline("number of gallons paint needed:\t{0}", paintneeded);
how use string.format
in expression? or can use in console.writeline
? if so, how implement it?
console.writeline("number of gallons paint needed:\t{0:f2}", area/450.0);
Comments
Post a Comment