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