Write a C++ Program to raise any number X to power N

By | 24.12.2016

Raise any number X to power N


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 .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.


Thanks for reading the post….

4.6 12 votes
Article Rating
Subscribe
Notify of
guest

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
janah

there is problem in the row 6;