Answers for "int max_of_four(int a, int b, int c, int d){ int ans; if (a > b && a > c && a > d) ans = a; else if (b > c && b > d) ans = b; else if (c > d) ans = c; else ans = d; return ans; }"

C++
0

int max_of_four(int a, int b, int c, int d){ int ans; if (a > b && a > c && a > d) ans = a; else if (b > c && b > d) ans = b; else if (c > d) ans = c; else ans = d; return ans; }

int max_of_four(int a, int b, int c, int d)
{
   int max = a;

   if (b > max)
     max = b;
   if (c > max)
     max = c;
   if (d > max)
     max = d;
  
   return max;
}
Posted by: Guest on January-12-2021

Code answers related to "int max_of_four(int a, int b, int c, int d){ int ans; if (a > b && a > c && a > d) ans = a; else if (b > c && b > d) ans = b; else if (c > d) ans = c; else ans = d; return ans; }"

Browse Popular Code Answers by Language