sarahsatan1473 sarahsatan1473
  • 02-04-2021
  • Computers and Technology
contestada

(TCO 4) The following function returns the _____ of the array elements. int mystery(int a[], int n) { int x=a[0]; for (int i=1; i

Respuesta :

Jamesanny20
Jamesanny20 Jamesanny20
  • 03-04-2021

Answer:

Answered below.

Explanation:

The function returns the largest of n number of elements in the array.

It takes an int array parameter int[] a, and an integer parameter n. It then assigns the first element of the array to an integer variable X.

The for loop begins at the second element of the array and loops less than n number of times. In each iteration, it checks if the element is greater than X and swaps it with X.

The function finally returns X.

Answer Link

Otras preguntas

True or False? Hannibal was very effective at capturing the major cities of Rome.
if 97% of the earth water is in the oceans why are there water scarcity problems ​
Which set of elements have similar physical and chemical properties? carbon, nitrogen, oxygen helium neon, argon hydrogen, lithium, beryllium fluorine, chlorine
Momentum = mass x velocity If a car has a mass of 1000kg and it has a velocity of 5 m/s, what is it’s momentum? Show your work and units in the calculation and
What is kinetic energy?
What is the capital of France
how can the NA help prevent UTI's
Importance of talent
help!! what is the volume of the rectangular prism? explain!!!
The surface area of a cube is 480 square inches. How long is each edge? Round to two decimal places.