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

Venn Diagram: In a school all of the 120 pupils must choose at least one of Archery, Badminton or Cycling. 63 pupils choose archery 62 pupils choose badminton
Solve the following equation 3m^2=3-8m. Find both values
can someone help me with number 25
how are plains formed
What is 5,389.029 rounded to the nearest hundreth
A packet is dropped from a stationary helicopter, hovering at a height 'h' from the ground level, reaches the ground in 12s. Calculate 1) value of 'h' "displac
1. Compare the location of electrons in an atom based on Bohr's theory with the location of electrons in an atom based on the current atomic theory. 2. Rutherf
what does the surface area represent in a cell
What role does carbon dioxide play in plant life processes
Mr Jones has 20,000 to invest. He invests part at 6% and part at 7%, if hr earns 1,280 in interest after 1 year, how much did he invest at each rate.