We help IT Professionals succeed at work.

# implementing a function

on
191 Views
Implement the function find_median. The function find_median accepts three integer values as formal parameters and returns the median of the three numbers. The median of three numbers is the number that is greater than one of the numbers and less than the other number. The median of 10, 30 and 20 is 20. The median of 5, 5 and 5 is 5. The median of 12, 20 and 12 is 12. A call to find_median will take the form:

median = find_median(num1,num2,num3);

i need this written out to implement this function...thanks in advance!
Comment
Watch Question

## View Solution Only

Commented:

Commented:
This one is on us!
(Get your first solution completely free - no credit card required)

Commented:
hmmm , beat to me,imladris :)
However , here it is:
int find_median(num1,num2,num3)
{
int seri[3],temp;
seri[0]=num1;
seri[1]=num2;
seri[2]=num3;
for(int i=0;i<2;i++){
if(seri[i]>=seri[i+1]){
temp=seri[i+1];
seri[i+1]=seri[i];
seri[i]=temp;
}
}

return seri[0]>seri[1]?seri[0]:seri[1];

}

Regards
W.Yinan

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

###### Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

Deciding to stick with EE.

Mohamed Asif

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
###### Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Connect with Certified Experts to gain insight and support on specific technology challenges including:

• Troubleshooting
• Research
• Professional Opinions
Unlock the solution to this question.

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.