67. C Program To find Power of a Given Number Without using Multiplication.
How does this program work?
- This Program is used to find the power of a number with out using multiplication.
Here is the code
#include <stdio.h>
int main(void)
{
int a,b;
printf("Enter Base value and Power\n");
scanf("%d%d",&a,&b );
int ans = a;
int inc = a;
int i, j;
for(i = 1; i < b; i++)
{
for(j = 1; j < a; j++)
{
ans += inc; //By incrementing b times we get power of the value
}
inc = ans;
}
printf("%d ",ans);
return 0;
}