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

#include 
#include 
int main(void){
     float   x,y,out;
     x=2.3;
     y=3.4;
     out = pow(x,y);
     printf("%f", out);
     return 0;
}
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
Your Rating




Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer