functions hackerrank solution in c++ code example
Example: 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;
}