fork download
  1. #include <stdio.h>
  2. int power(int x,int n)
  3. {
  4. if(n==0)
  5. return 1;
  6.  
  7. else
  8. return x*power(x,n-1);
  9. }
  10.  
  11. int main(void) {
  12. int x,n;
  13. scanf("%d %d",&x,&n);
  14. printf("%dの%d乗は%dです\n",x,n,power(x,n));
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 5320KB
stdin
2 10
stdout
2の10乗は1024です