FIND THE POWER VALUE, WITHOUT USING pow FUNCTION
#include<stdio.h>
#include<conio.h>
int a,s,d,f,g,h=1,j=1;
int pow(int,int);
void main()
{
clrscr();
printf('Enter two numbers ,first enter base & then power value");
scanf("%d%d",&a,&s);
d=pow(a,s);
printf("The result is =%d",d);
getch();
}
int pow(int f,int g)
{
if(h<=s)
{
j=j*a;
h++;
pow(a,s);
}
return(j);
}
Explanation: -
The logic behind power is that base value is multiplied itself as many times as the value of the power. I just use recursive function & 'j' variable store the multiplication value with every step.
Try it out.