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