Scientific Notation in C#

Justin picture Justin · Jan 22, 2017 · Viewed 14.6k times · Source

How do I assign a number that is in scientific notation to a variable in C#?

I'm looking to use Plancks Constant which is 6.626 X 10-34

This is the code I have which isn't correct:

 Decimal PlancksConstant = 6.626 * 10e-34;

Answer

Timothy G. picture Timothy G. · Jan 22, 2017

You should be able to declare PlancksConstant as a double and multiply 6.626 by 10e-34 like:

double PlancksConstant = 6.626e-34

Demo