Output of an integer number
Following is the format for an integer output namely %wd where 'w' specify the minimum field width necessary to print the integer value.
if w > 0 then the printing is right justified
if w < 0 then the printing is left justified
For eg:- Let a = 3248
if w > 0 then the printing is right justified
if w < 0 then the printing is left justified
For eg:- Let a = 3248
Statement | Output |
---|---|
printf("%d",a); | 3248 |
printf("%7d",a); | _ _ _3248 |
printf("%10d",a); | _ _ _ _ _ _3248 |
printf("% - 6d",a); | 3248_ _ |
printf("% - 9d",a); | 3248_ _ _ _ _ |
printf("% - 15d",a); | 3248_ _ _ _ _ _ _ _ _ _ _ |
0 comments:
Post a Comment