Write a C++ Program to raise any number X to power N. Here’s simple C++ Program to find power of a Number using pow( ) function in C++ Programming Language.
Here is source code of the C++ Program to raise any number X to power N. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
/* C++ Program to raise any number X to power N */
#include<iostream>
#include<math.h> //for pow() function
using namespace std;
int main()
{
int x,n,result;
cout<<"Enter value of X :: ";
cin>>x;
cout<<"\nEnter value of N :: ";
cin>>n;
result=pow(x,n);
cout<<"\nThe Power of Number [ "<<x<<" ^ "<<n<<" ] = "<<result<<"\n";
return 0;
}
OUTPUT : :
/* C++ Program to raise any number X to power N */
Enter value of X :: 3
Enter value of N :: 3
The Power of Number [ 3 ^ 3 ] = 27
Process returned 0
Above is the source code for C++ Program to raise any number X to power N which is successfully compiled and run on Windows System.The Output of the program is shown above .
Here is source code of the C++ Program to raise any number X to power N. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.
SOURCE CODE : :
OUTPUT : :
Above is the source code for C++ Program to raise any number X to power N which is successfully compiled and run on Windows System.The Output of the program is shown above .
need an explanation for this answer? contact us directly to get an explanation for this answer