Truncating double without rounding in C

Posted by Coder on Stack Overflow See other posts from Stack Overflow or by Coder
Published on 2010-03-31T20:30:17Z Indexed on 2010/03/31 20:33 UTC
Read the original article Hit count: 294

Filed under:
|

Lets consider we have a double R = 99.999999; (which may be obtained by a result of some other computation),now the desired output is 99.99

I tried using printf("%.2lf",R); but it's rounding off the value.How to get the desired output ? (preferably using printf)

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++