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,b,c,d;
  8. int result;
  9. //ここ↓を埋めてね2
  10. printf("a? ");
  11. scanf("%d", &a);
  12. printf("b? ");
  13. scanf("%d", &b);
  14. printf("c? ");
  15. scanf("%d", &c);
  16. printf("d? ");
  17. scanf("%d", &d);
  18.  
  19. result = max(max(a, b), max(c, d));
  20. printf("最大値 = %d\n", result);
  21. return 0;
  22. }
  23.  
  24. //max関数の定義
  25. int max(int x, int y){
  26. //ここ↓を埋めてね3
  27. return (x > y) ? x : y;
  28. }
  29.  
  30.  
  31.  
Success #stdin #stdout 0s 5324KB
stdin
1,5,c,d
stdout
a? b? c? d? 最大値 = 32767