Well there is a sligh problem with your code. You are using ^ as a power operator but there is no such operator which performs the power operations. This operator (^) is a bitwiase operator to calculate XOR.
To calculate the power you can use pow(double x, double y) function. It will calculate x power y.
Also make sure you include math.h header in your program as pow function is defined is this header file.