Use of ^ operator in vb.net

 

^ operator is the Arithmatic operator,^ operator raises a number to the power of another number.

Suppose if you want know the value of 2 to the three power or 2*2*2, then we can use ^ operator using this expression like 2 ^ 2 ^ 2.
Visual Basic always performs exponentiation in the Double Data Type (Visual Basic).The value of exponent can be fractional, negative, or both.

 

Dim value1, value2, value3, value4 As Double
value1 = 2 ^ 3
value2 = 2 ^ 2 ^ 2
value3 = (-3) ^ 2
value4 = (2.5) ^ 3

‘value1 = 8.0
‘value2 = 16.0
‘value3 = 9.0
‘value4 = 15.625