Skip to main content
added 23 characters in body
Source Link
Cherubim
  • 391
  • 1
  • 12

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.

And just one more way to do to find 2nd maximum among the 3 numbers is to add all three numbers and remove the maximum and minimum values.

$$ 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.

One more way to find the second maximum value among the 3 given values is to add all three numbers and remove the maximum and minimum values.

$$ 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.

added 61 characters in body
Source Link
Cherubim
  • 391
  • 1
  • 12

And just one more way to do to find 2nd maximum among the 3 numbers is to add all three numbers and remove the maximum and minimum values.

$$ 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.

And just one more way to do to find 2nd maximum among the 3 numbers is to add all three numbers and remove the maximum and minimum values.

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.

And just one more way to do to find 2nd maximum among the 3 numbers is to add all three numbers and remove the maximum and minimum values.

$$ 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.

Source Link
Cherubim
  • 391
  • 1
  • 12

And just one more way to do to find 2nd maximum among the 3 numbers is to add all three numbers and remove the maximum and minimum values.

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.