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