At this opportunity I will explain about defining formats and different from the% e,% f,% g.
% e function to display the real number in exponential notation, such as the following example;
# include
main ()
(
float A = 0.007654321
printf ( "% e \ n", A);
)
if the program is executed, the results:
7.654321e-003
% f function untukmenampilkan real numbers in the notation aaaa.aaaaaa, if you use a program like this:
# include
main ()(
float A = 0.007654321;
printf ( "% f \ n", A);)
then the output produced:
0.007654
% g function as substitutes% f or% e depends on the shortest.
example program:
# include
main ()(
float X1 = 345.6789;
float x2 = 98765432.1;
printf ( "% g% g \ n", X1, X2);)
the output after the program above was executed:
345,679 9.87654e +007
Langganan:
Posting Komentar (Atom)
0 comments