fork download
  1. #include<stdio.h>
  2. int powerlog(int a,int b){
  3. if(b==1) return a;
  4. int k = powerlog(a,b/2);
  5. int recAns = k * k;
  6. return recAns;
  7. }
  8. int main(){
  9. int a;
  10. printf("Enter a: ");
  11. scanf("%d",&a);
  12. int b;
  13. printf("Enter b: ");
  14. scanf("%d",&b);
  15. int p = powerlog(a,b);
  16. printf("The ans is %d",p);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
Enter a: Enter b: The ans is 0