fork download
  1. #include <stdio.h>
  2. //関数のプロトタイプ宣言
  3. //ここ↓を埋めてね1
  4. int max(int x, int y);
  5. //main関数
  6. int main(void) {
  7. int a=1,b=2,c=3,d=4;
  8. //ここ↓を埋めてね2
  9. int result;
  10. result = max(max(a, b), max(c, d));
  11.  
  12. printf("最大値: %d\n", result);
  13.  
  14.  
  15. }
  16.  
  17. // 二つの値を引き数として受け取り、大きい方の値を返す関数
  18. int max(int x, int y) {
  19. return (x > y) ? x : y;
  20. return 0;
  21. }
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
最大値: 4