EmbLogic's Blog

e11 doubt inassignment 1

what is meaning of %g in c

2 Responses to e11 doubt inassignment 1

  1. rahul mishra says:

    %g is like %f,%g use at the place of %f and cheak it

  2. rahul1989 says:

    %g is not like as %f it has the large difference when you use padding.
    eg.
    when you use printf(” %3g “, 10/3); it gives output 3.33
    here the significant digit( mentioned by padding ) are counted form the right most side of digit.

    but in case of %f
    eg ..
    printf(” %3f “, 10/3); it gives output
    3.333333
    ^^^
    note the differece the digit before decimal is placed with in 3 character space. but when result need more compartment of spaces then it does not affect the result.
    e.g..
    printf(” %3f “, 10000/3); it gives output 3333.333333

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>