C examples for Data Type:Introduction
To control precision with floating-point numbers, using numbering schemes between the % sign and the f character conversion specifier.
#include <stdio.h> int main()//www . ja va 2s . c o m { printf("%f", 55.55); 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); return 0; }