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. scanf("%d %d %d %d", &a, &b, &c, &d);
  10.  
  11. // max関数を入れ子にして、4つの最大値求める
  12. int MAX = max(max(a, b), max(c, d));
  13. printf("最大値 %d \n", MAX);
  14.  
  15. return 0;
  16. }
  17.  
  18. //max関数の定義
  19. int max(int x, int y){
  20. if(x > y){return x;}
  21. else {return y;}
  22. }
Success #stdin #stdout 0s 5320KB
stdin
1
2
3
4
stdout
最大値 4