And just oneOne more way to do to find 2nd maximumthe second maximum value among the 3 numbersgiven values is to add all three numbers and remove the maximummaximum and minimumminimum values.
$$ Second.largest(a,b,c)=a+b+c-max(a,b,c)-min(a,b,c) $$
$$ Second.largest(a,b,c)=a+b+c-max(a,b,c)-min(a,b,c) $$
This would be the function:
int find_second(int a, int b, int c)
{
return a+b+c-max(a,b,c)-min(a,b,c);
}
Here max() and min() are the functions to find maximum and minimum values among 3 numbers respectively.