Write a program to compute br using recursion where b represents base and r represents power

Program 2.1

---------------------------------------------------------------------------------------------------------------------

#include<iostream>
using namespace std;
int n;
int power(int b,unsigned int r)
{
if(r==1)
return b;
else
power(n*b,r-1);
}
int main()
{
unsigned int b,r,res;
cout<<"Enter the number and its power respectively  to get b raise to r:\n";
cout<<"Number:\t";
cin>>b;
::n=b;
cout<<"Power:\t";
cin>>r;
if(r==0)
res=1;
else
res=power(b,r);
cout<<"The required result is:\n"<<res;
return 0;


---------------------------------------------------------------------------------------------------------------------