#include <iostream.h>
#include <conio.h>
double power(double m,int n=2);
void main()
{
clrscr();
int n;
double m;
cout<<"\nEnter a number : ";
cin>>m;
cout<<"Enter power : ";
cin>>n;
cout<<"\nAnswer : "<<power(m,n);
getch();
}
double power(double m,int n)
{
int ans=1;
for(;n>0;n--)
ans=ans*m;
return ans;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.