fork download
  1. #include <stdio.h>
  2.  
  3. //関数のプロトタイプ宣言
  4. //ここ↓を埋めてね1
  5. int max(int x, int y);
  6.  
  7. //main関数
  8. int main(void) {
  9. int a,b,c,d;
  10.  
  11. //ここ↓を埋めてね2
  12. printf("4つの整数を入力してください: ");
  13. scanf("%d %d %d %d", &a, &b, &c, &d);
  14.  
  15. // max関数を入れ子にして最大値を求める
  16. printf("最大値は %d です。\n", max(max(a, b), max(c, d)));
  17.  
  18. return 0;
  19. }
  20.  
  21. //max関数の定義
  22. int max(int x, int y){
  23. //ここ↓を埋めてね3
  24. // xとyを比較し、大きい方の値を返す
  25. return (x > y) ? x : y;
  26. }
  27.  
  28.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
4つの整数を入力してください: 最大値は 1513533712 です。