Multiplying Columns of Numbers in C Programming

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
Rajini
Messages
619
Reaction score
4
Hello all,

I wrote a C program to multiply a column of numbers (for eg., number will look like this 10.45618) with some constant...
after multiplication i get the correct value (i tested using calculator).
Now the output is 0.00005672 (i use %14.9lf) ..but i want them to display like this: 5.672E or D-5.
E stands for 10.
thanks for your help.
 
Physics news on Phys.org
Check the documentation on format specifiers for printf. There are a lot of useful options, it would be good to know what's possible and know where to look things up -- so go googling!

I think for your particular issue, you want 'e' or 'g' instead of 'f'; I don't remember which one.