Code:
#include <stdio.h>
//function for calculating power
long int getPower(int b,int p)
{
long int result=1;
if(p==0) return result;
result=b*(getPower(b,p-1)); //call function again
}
void main()
{
int base,power, temp, temp1;
long int result;
printf("Enter value of base: ");
scanf("%d",&base);
temp=base;
if(temp<=99 && temp>=11)
{
printf("Enter value of power: ");
scanf("%d",&power);
result=getPower(base,power);
printf("%d to the power of %d is: %ld\n",base,power,result);
}
else
{
printf("Base should be between 11 and 99\n");
}
}
these are the code and it is working but i only need when i enter even number it must show me message to enter odd number and the opposite in the power
also the power doesn't show message enter between 2 and 20 ?