fork download
  1. #include <stdio.h>
  2.  
  3. // 関数のプロトタイプ宣言
  4. int max(int x, int y);
  5.  
  6. // main関数
  7. int main(void) {
  8. int a,b,c,d;
  9.  
  10. // 4つの整数をいれる
  11. scanf("%d %d %d %d", &a, &b, &c, &d);
  12.  
  13. // 入れ子の max で4つの最大値を求める(main内で大小比較はしない)
  14. int aaa = max( max(a, b), max(c, d) );
  15.  
  16. printf("%d\n", aaa);
  17. return 0;
  18. }
  19.  
  20. // max関数の定義(2つのうち大きい方を返す)
  21. int max(int x, int y){
  22. return (x > y) ? x : y;
  23. }
  24.  
  25.  
Success #stdin #stdout 0.01s 5296KB
stdin
2 3 4 5
stdout
5