I thought that ^ did that. I expected:
10^0=1
10^1=10
10^2=100
What I'm getting
10^0=10
10^1=11
10^2=8
the actual code is
int value = 10 ^ exp;
replacing exp for 0, 1, and 2 What does the ^ operator do?
Definition of operator 1 : one that operates: such as. a : one that operates a machine or device. b : one that operates a business. c : one that performs surgical operations. d : one that deals in stocks or commodities.
Operators are the backbone of any program and they are used for everything from very simple functions like counting to complex algorithms like security encryption. There are several classifications of operators and each of them can have one or more operands, a specific data that is to be manipulated.
Arithmetic Operators are used to perform mathematical calculations. Assignment Operators are used to assign a value to a property or variable. Assignment Operators can be numeric, date, system, time, or text. Comparison Operators are used to perform comparisons.
Math.Pow(x, y) to get x raised to the power of y. You were doing an XOR. C# operators
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With