hi everyone; i am using a float value for my calculation eg: weight = 999.99 (ideally) but float weight = 999.989999 (by float data type as we get 6 digits after decimal) i am not displaying this value but i want to use weight = 999.99 for my calculation. thus how to truncate as well as roundoff it upto 2 digits after decimal thank u all
1) Use integers whenever you can. 2) Look into the %g formatting character. 3) Look through the math functions available. 4) Try Google - this is a generic question with a huge number of answers...