Printing float values in C

Hi,

I have small problem to print float value in the fallowing code

float Cx, W,f=250000, Cr=92.00,pi=3.14;

W=2*pi*f;
Cx = 1/W.Cr;  //Cx value will be come around like 7.07E-9.
printf("capacitance value: %.10f",Cx);

I am trying to print Cx value using above code but it was not printing like that, the value i am getting when i tried to print Cx value using above code is 7.077140 . I am getting of 6 digit precision value only. How to get 10 digit precision value or how to print like this 7.07E-9.

Thanks in advance.

Your program does not compile. What is "1/W.CR" supposed to be? That is not valid C.

Ever heard the old adage "measure with micrometer, mark with chalk, cut with axe"? Not even pi is accurate here, you're not going to get anything fantastic out.

You can force scientific notation with %e. From man 3 printf :

       e, E   The  double  argument  is  rounded  and  converted  in the style
              [-]d.ddde+-dd where there is one digit before the  decimal-point
              character and the number of digits after it is equal to the pre-
              cision; if the precision is missing, it is taken as  6;  if  the
              precision  is  zero,  no  decimal-point character appears.  An E
              conversion uses the letter E (rather than e)  to  introduce  the
              exponent.   The exponent always contains at least two digits; if
              the value is zero, the exponent is 00.

In addition to Corona688 reply, you should be aware that there is no way to get an accurate 10 digit precision with floats. You can only expect about 7 digit precision with them. You need to use double precision variables (~ 16 digit precision) instead.

Isn't just this?:

printf("%lf", floatNumber);