fork(1) download
  1. #include <stdio.h>
  2. //プロトタイプ宣言
  3. int square(int x, int y); //2つのint型引数を受け取り、その和の二乗を返す
  4. int sum(int x, int y); // 2つのint型引数を受け取り、その二乗の和を返す
  5. int max(int x, int y); //2つのint型引数を受けとり、そのうち大きいほうを返す
  6.  
  7. int square(int x,int y){
  8. return (x+y)*(x+y);
  9. }
  10.  
  11. int sum(int x,int y){
  12. return x+x+y+y;
  13. }
  14.  
  15. int max(int x,int y){
  16. if(square(x,y)>sum(x,y)){
  17. return square(x,y);
  18. }
  19. else{
  20. return sum(x,y);
  21. }
  22. }
  23.  
  24. int main(void){
  25. int a,b;
  26. scanf("%d%d",&a,&b); //ユーザーから2つの整数を入力
  27. printf("%d\n",max(a,b)); //結果を表示
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 5312KB
stdin
5 5
stdout
100