c语言中对字段宽度的理解?

 1 /*************************************************************************
 2     > File Name: printf.c
 3     > Author: Mr.Yang
 4     > Purpose:演示printf的用法 
 5     > Created Time: 2017年05月21日 星期日 10时07分44秒
 6  ************************************************************************/
 7 
 8 #include <stdio.h>
 9 #include <stdlib.h>
10 
11 int main(void)
12 {
13         float i = 10000.123;
14 
15         printf("%5f\n",i);
16         printf("%10f\n",i);
17         printf("%15f\n",i);
18         printf("%20f\n",i);
19         printf("%25f\n",i);
20 
21         return 0;
22 }

运行结果:

10000.123047
10000.123047
   10000.123047
        10000.123047
             10000.123047

 

posted @ 2017-05-21 10:16  杨来  阅读(3093)  评论(0编辑  收藏  举报