Im stuck on a logical problem and cant figure it out im sure it is very easy to most of you. Im trying to figure out the larger 2 out of 3 integers when i call them into a function from main program so far i have
does anyone know how to write a simple function that will take 3 ints and find the sum of the higher 2?
Code:
this is what i got so far
int findsum(int a,int b,int c)// will find the highest int and return it to our main program
{
int max,max2;// this sets our local variable max
// next we will find the larger of our first 2 variables
if( a>=b)
{ max=a;
} else
max=b;
// next we will take our local variable which holds max from the first two
//variables and compare it to our third to get the larger
if (max<c)
max=c;
i have no idea how to get the second highest number and add it to max