#include<iostream.h>
#include<conio.h>int power(int,int);
int main()
{
int base,pow,ans;
cout<<"Enter base:";
cin>>base;
cout<<"Enter power:";
cin>>pow;
ans=power(base,pow);
cout<<"The answer is:"<<ans;
getch();
return 0;}
int power(int b,int p)
{
int rp=1;
for(int i=1;i<=p;i++)
rp=rp*b;
return rp;}
#include<conio.h>int power(int,int);
int main()
{
int base,pow,ans;
cout<<"Enter base:";
cin>>base;
cout<<"Enter power:";
cin>>pow;
ans=power(base,pow);
cout<<"The answer is:"<<ans;
getch();
return 0;}
int power(int b,int p)
{
int rp=1;
for(int i=1;i<=p;i++)
rp=rp*b;
return rp;}
No comments:
Post a Comment