fork download
  1. #include <stdio.h>
  2.  
  3. // 練習問題A:絶対値を返す関数
  4. int func(int n){
  5. return (n < 0) ? -n : n;
  6. }
  7.  
  8. int main(void) {
  9. int n, m = -3;
  10. n = func(m);
  11. printf("%dの絶対値は%d\n", m, n);
  12. return 0;
  13. }
  14.  
  15.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
-3の絶対値は3