Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
updated broken link
Source Link
Pankaj Prakash
  • 2.4k
  • 32
  • 32

First of all ^ is a Bitwise XOR operatorBitwise XOR operator not an operator to find power operator.

You can use other things to find power of any number. You can use for loop to find power of any numberfor loop to find power of any number

Here is a program to find x^y i.e. xy

double i, x, y, pow; x = 2; y = 5; pow = 1; for(i=1; i<=y; i++) { pow = pow * x; } printf("2^5 = %lf", pow); 

You can also simply use pow() function to find power of any numberpow() function to find power of any number

double power, x, y; x = 2; y = 5; power = pow(x, y); /* include math.h header file */ printf("2^5 = %lf", power); 

First of all ^ is a Bitwise XOR operator not an operator to find power.

You can use other things to find power of any number. You can use for loop to find power of any number

Here is a program to find x^y i.e. xy

double i, x, y, pow; x = 2; y = 5; pow = 1; for(i=1; i<=y; i++) { pow = pow * x; } printf("2^5 = %lf", pow); 

You can also simply use pow() function to find power of any number

double power, x, y; x = 2; y = 5; power = pow(x, y); /* include math.h header file */ printf("2^5 = %lf", power); 

First of all ^ is a Bitwise XOR operator not power operator.

You can use other things to find power of any number. You can use for loop to find power of any number

Here is a program to find x^y i.e. xy

double i, x, y, pow; x = 2; y = 5; pow = 1; for(i=1; i<=y; i++) { pow = pow * x; } printf("2^5 = %lf", pow); 

You can also simply use pow() function to find power of any number

double power, x, y; x = 2; y = 5; power = pow(x, y); /* include math.h header file */ printf("2^5 = %lf", power); 
Source Link
Pankaj Prakash
  • 2.4k
  • 32
  • 32

First of all ^ is a Bitwise XOR operator not an operator to find power.

You can use other things to find power of any number. You can use for loop to find power of any number

Here is a program to find x^y i.e. xy

double i, x, y, pow; x = 2; y = 5; pow = 1; for(i=1; i<=y; i++) { pow = pow * x; } printf("2^5 = %lf", pow); 

You can also simply use pow() function to find power of any number

double power, x, y; x = 2; y = 5; power = pow(x, y); /* include math.h header file */ printf("2^5 = %lf", power);