fork(1) download
  1. #include <stdio.h>
  2.  
  3. int power(int base, int exponent){
  4. int result=1;
  5. for(int i=0;i<exponent;i++){
  6. result*=base;
  7. }
  8. return result;
  9. }
  10.  
  11. int func(int x, int y, int z){
  12. return power(x, z) + power(y, z);
  13. }
  14.  
  15. int main() {
  16. int result;
  17.  
  18. // 引数3, 4, 2を渡してfuncを呼び出す
  19. result = func(3, 4, 2);
  20.  
  21. // 結果を表示
  22. printf("Result: %d\n", result);
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5320KB
stdin
6 3 2
stdout
Result: 25