Hi ,

I have a beginners question , I would like to print variable with 2 decimal places.

printf("%.2f",a); all nice and dandy , but what if i want to set decimal places dynamically.

Example (i know this doesnt work, just for demonstration what I need ):

int dec=2;
printf("%.%decf",dec,a);

Is it posible to do it this way ?