when i print out a big answers 13100000000000000 i wanted to say 13.1e12
this should happen to all different answers that come out

Look at the format specifiers here and you will find the one you want.

by just using the "e" format, you'll get standard scientific exponentiation, but it might not be exactly what you're looking for

for instance if you specify 2 decimal places like so: printf("%.2e",myDoubleValue); your example values will be printed as 1.20e-5 and 1.31e13 it will not force them along standard "engineering prefix" exponent values (groups of 3, like 'kilo' 'mega' 'micro' 'nano' etc.) ... your example values seem to suggest that might be a requirement for you. If so, the problem becomes somewhat more complicated. if not, then the %e format specifier is sufficient.


.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.