Is there an exponent operator in C#?
The C# language doesn't have a power operator. However, the .NET Framework offers the Math.Pow
method:
Returns a specified number raised to the specified power.
So your example would look like this:
float Result, Number1, Number2;
Number1 = 2;
Number2 = 2;
Result = Math.Pow(Number1, Number2);
I stumbled on this post looking to use scientific notation in my code, I used
4.95*Math.Pow(10,-10);
But afterwards I found out you can do
4.95E-10;
Just thought I would add this for anyone in a similar situation that I was in.