C++ PROGRAM TO CALCULATE POWER OF A NUMBER.
#include <iostream>
#include <math.h>
#include <conio.h>
using namespace std;
float power(float,float);
int main()
{
float num,n;
cout<<"Enter the Number: ";
cin>>num;
cout<<"\nEnter the Power: ";
cin>>n;
cout<<num<<" Raised to Power "<<n<<" is ";
cout<<power(num,n);
getch();
return 0;
}
float power(float x,float a)
{
return pow(x,a); //Power Function
}
Also See Cosine Series Program Click Here
#include <iostream>
#include <math.h>
#include <conio.h>
using namespace std;
float power(float,float);
int main()
{
float num,n;
cout<<"Enter the Number: ";
cin>>num;
cout<<"\nEnter the Power: ";
cin>>n;
cout<<num<<" Raised to Power "<<n<<" is ";
cout<<power(num,n);
getch();
return 0;
}
float power(float x,float a)
{
return pow(x,a); //Power Function
}
Also See Cosine Series Program Click Here