write C programs that uses both recursive and non-recursive functions to compute x^n using recursive
Program:
#include<stdio.h>
#include<math.h>
int main()
{
int result,base,exponent;
printf("\n Please enter the base and exponent values:\n");
scanf("%d %d",&base,&exponent);
result=pow(base,exponent);
printf("\n The final result of %d power %d=%d",base,exponent,result);
return 0;
}
output:
0 Comments