// program to evaluate xn
#include <iostream.h>
int main ()
{
int x,n;
cout<<”\n Enter any number: ”;
cin>>x;
cout<<”\n Enter non-negative number for power: ”;
cin>>n;
int y=1,count=1;
do
{
y= y*x;
count++;
} while(count<=n);
cout<<”\n”<<x<<” power of”<<n<<”= ”<<y;
return 0;
}
No comments:
Post a Comment