#include<iostream.h>
#include<conio.h>
int Pow(int , int);
main(){
int num, pow, res;
cout<<"Enter the number u want the power: ";
cin>>num;
cout<<endl
<<"enter the power: ";
cin>>pow;
cout<<endl;
res=Pow(num,pow);
cout<<"The power of "<<num<<" is "<<pow<<" and result is "<<res<<endl;
getch();
}
int Pow(int base, int n)
{
int i,p;
p=base;
if(base==0)
{
return 1;
}
else
{
for(i=1;i<=n-1;i++)
{
p=p*base;
}
return p;
}
}
If the power is set as 0, its not generating yhe result.
Help me out.