C语言:%5.2f 含义
#include <stdio.h> main() { float a=-3.14153265; printf("%8.4f\n",a) ; printf("%7.4f\n",a) ; printf("%6.4f\n",a) ; printf("%5.4f\n",a) ; printf("%4.4f\n",a) ; printf("%3.4f\n",a) ; printf("%2.4f\n",a) ; printf("%1.4f\n",a) ; printf("%0.4f\n",a) ; a=+3.14153265; printf("\n%8.4f\n",a) ; printf("%7.4f\n",a) ; printf("%6.4f\n",a) ; printf("%5.4f\n",a) ; printf("%4.4f\n",a) ; printf("%3.4f\n",a) ; printf("%2.4f\n",a) ; printf("%1.4f\n",a) ; printf("%0.4f\n",a) ; int b=12; printf("\n%2d\n",b); printf("%3d\n",b); printf("%4d\n",b); printf("%5d\n",b); b=-12; printf("\n%2d\n",b); printf("%3d\n",b); printf("%4d\n",b); printf("%5d\n",b); getchar(); }