answersLogoWhite

0

int secondmax (int a[], int n)

{

int i, max, second;

for (i=0; i

if (i==0 a[i]>max) second= max, max= a[i];

else if (i==1 a[i]>second) second= a[1];

}

return second;

}

int middle (int a[3])

{

return secondmax (a, 3);

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering
Related Questions

What is the algorithm and draw flow chart to find the sum and average of 3 numbers?

Algorithm to find the sum and average of 3 numbers: Start. Input three numbers (let's call them A, B, and C). Calculate the sum (Sum = A + B + C). Calculate the average (Average = Sum / 3). Output the sum and average. End. Flowchart: [Start] ↓ [Input A, B, C] ↓ [Sum = A + B + C] ↓ [Average = Sum / 3] ↓ [Output Sum, Average] ↓ [End]


How can you use the Euclidean Algorithm to find the GCF of three numbers?

By dividing


How do you describe an algorithm with rational numbers?

Describe an algorithm for dividing rational numbers.


How to write an algorithm that accepts five numbers and displays the sum and average of the numbers?

1.Start Algorithm 2.Enter first number 3.Enter second number 4.Enter third number 5.Enter fourth number 6.Enter fifth number 7.Add five number 8.display five number / 2 9.Display result 10.End Algorithm


What is the average of 5000 and 7000?

To calculate the average of two numbers, add them together, and divide the result by 2. (For the average of three numbers, you add up the three numbers, and divide by three, etc.) The average is (5000 + 7000)/2 = 6000


What is the GCF of 180 336 and 504?

You can use Euclid's algorithm to calculate the gcf of two of the numbers - then use Euclid's algorithm again with the result and the third number.Or you can factor all the numbers into prime factors, and check which prime factors occur in all three numbers.


What are the three numbers if the average of three consecutive numbers is 126?

125, 126 and 127.


Could an average of three numbers be one of those three numbers?

Yes. For example, the average of 5, 7, and 9 is 7.


What are three prime numbers where the average is a prime number?

3, 5, and 7 are three prime numbers whose average is 5.


What is the average of 51 52 on 56?

The average of the numbers 51, 52, and 56 is 53. To get the average you would add all three numbers and then divide by three.


The average of the first three numbers was sixThe average of the next seven numbers was 19 What was the overall average of all 10 numbers?

12


What are three prime numbers where the average is also a prime number?

3, 5, and 7 are three prime numbers whose average is 5.