%.2f displays only two zeroes after the decimal point.
#include
main(){
printf("%.1f", 3.123456);
printf("\n%.2f", 3.123456);
printf("\n%.3f", 3.123456);
printf("\n%.4f", 3.123456);
printf("\n%.5f", 3.123456);
printf("\n%.6f", 3.123456);
}
3.1
3.12
3.123
3.1235
3.12346
3.123456