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