fork download
  1. #include <stdio.h>
  2. //練習問題A
  3.  
  4. int func(int m){
  5. if(m>0){
  6. return m;
  7. }
  8. else
  9. return -m;
  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 0.01s 5284KB
stdin
Standard input is empty
stdout
-3の絶対値は3