pow()
We will get first number to the power of second number ( x to the power of y ) by using pow()
function.
pow(x,y)
x, y = two input numbers .
Example with integer as inputs
#include <stdio.h>
#include <math.h>
int main(void){
int x,y,out;
x=2;
y=3;
out = pow(x,y);
printf("%d", out);
return 0;
}
The above code will give this output.
8
Example with float variables
pow(num1,num2);
Output is here
16.977535
Example with negative variables
#include <stdio.h>
#include <math.h>
int main(void){
float x,y,out;
x=2.3;
y=-3.4;
out = pow(x,y);
printf("%f", out);
return 0;
}
0.058901
This article is written by plus2net.com team.
plus2net.com