fork download
  1. #include <stdio.h>
  2. int power(int a,int b){
  3. if(b==0) return 1;
  4. else return a*power(a,b-1);
  5. }
  6. int main(void) {
  7. int a;
  8. printf("Enter the base: \n");
  9. scanf("%d",&a);
  10. int b;
  11. printf("Enter the power: \n");
  12. scanf("%d",&b);
  13. int x= power(a,b);
  14. printf("The value of %d raise to power %d is %d",a,b,x);
  15.  
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 5328KB
stdin
2
5
stdout
Enter the base: 
Enter the power: 
The value of 2 raise to power 5 is 32