Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Thursday, February 11, 2010

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





















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

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP