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