exponent - Why can we not use a variable as value of e in C -


My compiler keeps this error in error that I need to use one digit for this:

Xek

Where R is the power for the rendering function such as X, such as X:

  double x; For (int k = 1; k & lt; 10; k ++) {x = 4ek; }    

e for the floating point number in C It has the special code specification % e and % E , which is to print a temporary point number in e notation. But neither the exponents nor the Mantissa can be variable. .

x = 4.0e7; Completely okay.

But for variable power, you need to use the standard math library function exp or pow .

x = pow (4, k);

or

x = 4 * exp (k);

The way you are using it in a loop, you can customize it by assuming the last count value as follows: ( x is being started on 1 .)

x = x * 4;

Each time the loop runs x is multiplied by 4 , so basically k th Loop run x = 4 * exp (k); .

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -