Sometimes in a problem we are asked to print our values correct to 3 decimal places. Simply printing 3 d.p using printf ( “%.3lf\n”, variable ) wrongly prints -0.000 sometimes. For example:
printf ( "%.3lf\n", -0.000001 );
This outputs -0.000. This then causes Wrong Answer for the problem. How do I avoid it?