Calculates the power of n raised by m, where n and m are user-specified values.

Calculates the power of n raised by m, where n and m are user-specified values.

Solution :
Input Screen
#include
using namespace std;
int main()
{
// n is our power value
int n;
//here m is our base value
// and result will be display the base and the power
float m, result = 1;
cout << "Enter m and n respectively: "; cin >> m >> n;
//here “^” sign shows the power
cout << m << "^" << n << " = "; //condition while (n != 0) { result *= m; --n; } //output result cout << result; return 0; }

Output Screen

Leave a Comment

Your email address will not be published. Required fields are marked *