fork download
  1. #include <stdio.h>
  2.  
  3. //引数の二乗を返す関数
  4. int square(int x){
  5. if(x<0){
  6. x=-1*x;
  7. }
  8. return x*x*x;
  9. }
  10. //main関数
  11. int main(void) {
  12. int a;
  13. a = -3;
  14. printf("%d^3 = %d\n",a,square(a));
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
-3^3 = 27