//Program to calculate m^n
#include<iostream>
using namespace std;
int main(void)
{
int m,n,i,x;
cout<<"Enter value of base (m) : ";
cin>>m;
cout<<"Enter the value of power (n): ";
cin>>n;
x=m;
for(i=n-1;i>0;i--)
{
x=x*m;
}
cout<<m<<"^"<<n<<" = "<<x;
}
No comments:
Post a Comment
Comments please: