fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int potega(int x, int n)
  5. {
  6. if(n==0) return 1;
  7. if(n&1) return x*potega(x, n-1);
  8. else
  9. {
  10. int a=potega(x, n/2);
  11. return a*a;
  12. }
  13. }
  14.  
  15. int main()
  16. {
  17. printf("%d\t%d\t%d\t%d", potega(0, 5), potega(13, 3), potega(13, 0), potega(12, 1));
  18. return 0;
  19. }
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
0	2197	1	12