fork download
  1. #include <stdio.h>
  2.  
  3. int power(int a, int b);
  4.  
  5. int main(void){
  6. printf("2の3乗は%dです。\n", power(2, 4));
  7. return 0;
  8. }
  9.  
  10. int power(int a, int b){
  11. int i, c = a;
  12. for(i=1;i>=b;i++){
  13. c=c*a;
  14. }
  15. return c;
  16. }
  17.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
2の3乗は2です。