Q:

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

belongs to collection: C++ Number Solved Programs

0

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.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 .

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Number Solved Programs

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a C++ Program to find Addition of Two Number... >>
<< C++ Program to Find Sum and Average of three numbe...