pow() function in C language are used to find the power of any number.
-It is define in math.h header file.
Syntax-
pow(a,b);
// it will return the a to the power b.
Example-
pow(2,1) will return 2
pow(2,4) will return 16
pow(2,5) will return 32
pow(2,10) will return 1024
pow(5,0) will return 1
pow(2,0) will return 1
pow(1,1000) will return 1
program:
#include < iostream>
#include< math.h>
using namespace std;
int main()
{
int a,b,ans;
cout<<"Enter first number"<< endl;
cin>>a;
cout<<"Enter second number"<< endl;
cin>>b;
ans=pow(a,b);
cout<<"a to the power b is: "<< ans;
return 0;
}
Enter first number
2
Enter second number
4
a to the power b is: 16