Professional Documents
Culture Documents
Buildin Function Sample Program
Buildin Function Sample Program
Buildin Function Sample Program
#include <cstdlib>
#include<cmath>
using namespace std;
int main ()
{
//Square Root and power of a number
cout<<"Square Root and power of a number"<<endl;
double a,b;
double sqrtA, sqrtB, powerNum;
cout<<"Enter a and b: \n";
cin>>a>>b;
sqrtA = sqrt(a);
sqrtB = sqrt(b);
cout<<fixed;
cout.precision (2);
cout<<"the square root of "<<a <<" is "<<sqrtA<<endl;
cout<<"the square root of "<<b <<" is "<<sqrtB<<endl;
powerNum = pow (a,b);
cout <<a<<" to the power of "<<b<<" is "<<powerNum<<endl;