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