Width and precision specifiers can be replaced by an *
, that makes printf
look for the value in the arguments.
printf("%5.3f", M_PI);
is equivalent to
printf("%*.*f", 5, 3, M_PI);
but now 5 and 3 can be replaced with expressions calculated at runtime.
The rest of your exercise should be trivial.
1
solved Make table for pi using C coding language [closed]