fork(1) download
  1. #include <stdio.h>
  2. // 引数 n が偶数かどうかを判定する関数(偶数なら1、奇数なら0を返す)
  3. int evenNumber(int n) {
  4. int x;
  5. x = 1;
  6. if (n % 2 == 1) {
  7. x = 0;
  8. }
  9. return x;
  10. }
  11.  
  12. int main(void) {
  13. int a = 20;
  14. int b;
  15.  
  16. b = evenNumber(a);
  17. printf("%dは偶数かどうか:%d\n", a, b);
  18.  
  19. return 0;
  20. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
20は偶数かどうか:1