G And E In C

[Solved] G And E In C | C - Code Explorer | yomemimo.com
Question : %g and %e in c

Answered by : abid-mbudisor1clu

[1]
E = exponent expression, simply means power(10, n) or 10 ^ n
F = fraction expression, default 6 digits precision
G = gerneral expression, somehow smart to show the number in a concise way
[2]
%g is a format specifier used in the C language like %d , %c and so on.
%g gives the result in either %f ( Floating point ) or %e ( Scientific
notation ) depending upon which one is short.
[3]
They are both examples of floating point input/output.
%g and %G are simplifiers of the scientific notation floats %e and %E.
%g will take a number that could be represented as %f (a simple float or
double) or %e (scientific notation) and return it as the shorter of the two.
The output of your print statement will depend on the value of sum.

Source : | Last Update : Sun, 19 Jun 22

Answers related to g and e in c

Code Explorer Popular Question For C