Output of a float number
The format for this output is %w.pf where 'w' specify the minimum field width and 'p' specify the number of position after the decimal point
If w > 0 then the printing is right justify.
If w < 0 then the printing is left justify.
For eg:- a = 32.289
If w > 0 then the printing is right justify.
If w < 0 then the printing is left justify.
For eg:- a = 32.289
Statement | Output |
---|---|
printf("%f",a); | 32.289 |
printf("%8.3f",a); | _ _32.289 |
printf("%10.2f",a); | _ _ _ _ _32.29 |
printf("% - 7.3f",a); | 32.289_ |
printf("% - 11.3f",a); | 32.289_ _ _ _ _ |
printf("% 11.4f",a); | _ _ _ _32.2890 |
0 comments:
Post a Comment