c# - how to return double from double plus double? -
i hava 2 double variables, , when sum them return me int variable. want return double too. should do? thank you!
example:
double d = 4.0; double myd = 4.0; console.writeline ( d+myd ); // returns me 8 want 8.0 .
the value 8 , 8.0 same. if want decimals shown in results, use converter n2 fixed 2 sigdig after decimal.
console.writeline((d+myd).tostring("n2"));
Comments
Post a Comment